diff --git a/.helm/siibra-api/templates/deployment-worker-v4.yaml b/.helm/siibra-api/templates/deployment-worker-v4.yaml index 3c9fa1f..a6c79f8 100644 --- a/.helm/siibra-api/templates/deployment-worker-v4.yaml +++ b/.helm/siibra-api/templates/deployment-worker-v4.yaml @@ -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: diff --git a/new_api/v3/serialization/map.py b/new_api/v3/serialization/map.py index 96ba828..0ef9d4b 100644 --- a/new_api/v3/serialization/map.py +++ b/new_api/v3/serialization/map.py @@ -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): @@ -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,