Skip to content

Commit

Permalink
fix: add cleared name to volume indices
Browse files Browse the repository at this point in the history
  • Loading branch information
xgui3783 committed Aug 26, 2024
1 parent dc90707 commit 2633be2
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .helm/siibra-api/templates/deployment-worker-v4.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
{{- if .Values.autoscaling.enabled }}


apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "siibra-api.fullname" $ }}-worker-hpa-v4
labels:
queuename: all
{{- include "siibra-api.labels" $ | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "siibra-api.fullname" $ }}-worker-v4
minReplicas: {{ $.Values.autoscaling.minReplicas }}
maxReplicas: {{ $.Values.autoscaling.maxReplicas }}
metrics:
{{- if $.Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ $.Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if $.Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ $.Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}

---
{{- end}}

apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
25 changes: 25 additions & 0 deletions new_api/v3/serialization/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ def parse_archive_options(archive: Union[Archive, None]):
return "", ""
return archive["format"], f" {archive['file']}"


REMOVE_FROM_NAME = [
"hemisphere",
" -",
"-brain",
"both",
"Both",
]

REPLACE_IN_NAME = {
"ctx-lh-": "left ",
"ctx-rh-": "right ",
}


def clear_name(name: str):
"""clean up a region name to the for matching"""
result = name
for word in REMOVE_FROM_NAME:
result = result.replace(word, "")
for search, repl in REPLACE_IN_NAME.items():
result = result.replace(search, repl)
return " ".join(w for w in result.split(" ") if len(w))

@serialize(Map)
def map_to_model(mp: Map, **kwargs):

Expand Down Expand Up @@ -74,6 +98,7 @@ def map_to_model(mp: Map, **kwargs):
if value.get("label"):
new_index["label"] = value.get("label")
indices[regionname].append(new_index)
indices[clear_name(regionname)].append(new_index)
return MapModel(
id=id,
name=name,
Expand Down

0 comments on commit 2633be2

Please sign in to comment.