Skip to content

Commit d1f3f1f

Browse files
committed
fix: nan in dataframe
1 parent ca5a1d5 commit d1f3f1f

File tree

7 files changed

+46
-3
lines changed

7 files changed

+46
-3
lines changed

.helm/adhoc/cronjob-kubectl-top-pod.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,35 @@ spec:
3939

4040
# to enable/disable
4141
# kubectl patch cronjobs cronjob-pod-usage -p '{"spec" : {"suspend" : true }}'
42+
43+
---
44+
apiVersion: batch/v1
45+
kind: CronJob
46+
metadata:
47+
name: cronjob-trim-old-log-usage
48+
spec:
49+
# run two month
50+
schedule: "41 1 */5 */2 *"
51+
concurrencyPolicy: Replace
52+
jobTemplate:
53+
spec:
54+
template:
55+
spec:
56+
containers:
57+
- name: cronjob-trim-old-log-usage
58+
image: docker-registry.ebrains.eu/monitoring/kubectl:v1.29.2
59+
imagePullPolicy: Always
60+
command:
61+
- /bin/ash
62+
- -c
63+
# delete all files over 30 days of modification date
64+
- "find /siibra_api_logs -mindepth 1 -maxdepth 1 -mtime +30 -delete"
65+
volumeMounts:
66+
- mountPath: /siibra_api_logs
67+
name: log-volume
68+
69+
restartPolicy: OnFailure
70+
volumes:
71+
- name: log-volume
72+
persistentVolumeClaim:
73+
claimName: log-volume-claim

.helm/siibra-api-v4-server/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ version: 0.1.0
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "0.3.21-rc9"
24+
appVersion: "0.3.21-hotfix2"

.helm/siibra-api-v4-worker/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ version: 0.1.0
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "0.3.21-rc9"
24+
appVersion: "0.3.21-hotfix2"

.helm/siibra-api-v4-worker/templates/_helpers.tpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ Expand the name of the chart.
55
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
66
{{- end }}
77

8+
{{- define "siibra-api-v4-worker.image-full-spec" -}}
9+
{{- if eq (substr 0 7 .Values.image.spec) "sha256:" -}}
10+
{{- printf "%s@%s" .Values.image.repository .Values.image.spec }}
11+
{{- else -}}
12+
{{- printf "%s:%s" .Values.image.repository .Values.image.spec }}
13+
{{- end -}}
14+
815

916
{{/*
1017
Define cache-dir. append -rc if is rc

.helm/siibra-api-v4-worker/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ image:
2121
pullPolicy: IfNotPresent
2222
# Overrides the image tag whose default is the chart appVersion.
2323
tag: 0.3-worker
24+
spec: 0.3-worker # can be 1/ tag 2/ sha256:<sha-hash>
2425

2526
imagePullSecrets: []
2627
nameOverride: ""

api/serialization/_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def pdseries_to_model(series: Series, **kwargs) -> SeriesModel:
5151
name=series.name,
5252
dtype=str(series.dtype),
5353
index=[instance_to_model(el) for el in series.index],
54-
data=series.values.tolist()
54+
data=instance_to_model(series.values.tolist())
5555
)
5656

5757
@serialize(DataFrame)

api/serialization/util/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
NonStrKeyException,
88
)
99
from typing import Any, Dict, _GenericAlias
10+
import math
1011

1112
REGISTER: Dict[Type, Callable[..., ConfigBaseModel]] = {}
1213

@@ -50,6 +51,8 @@ def instance_to_model(instance: Any, * , use_class: Type=None, skip_classes: Lis
5051
if instance is None:
5152
return None
5253
if isinstance(instance, (str, int, float)):
54+
if math.isnan(instance):
55+
return None
5356
return instance
5457
if isinstance(instance, (list, tuple)):
5558
return [instance_to_model(item) for item in instance]

0 commit comments

Comments
 (0)