Skip to content

Commit 0fada5c

Browse files
feat!(config): support version lists in preprocessing pipeline config for better developer experience (#5083)
resolves #4703 ### Config changes (non-breaking) Support version as list in preprocessing part of config ### Description Bumping prepro pipeline versions has been a bit of a pain due to having to copy/paste/delete or comment/uncomment entries - in particular also when nothing changed but the version (which is the most common case). This PR makes bumping prepro versions easier by allowing version to be a list, which acts as syntactic sugar for a copy for each entry in the list with version substituted by each item's value. To catch mistakes, we validate that each version appears at most once and throw an error if that's not the case. This change is fully backwards compatible. What's *breaking* is that we can now take advantage of this new feature! Example usage: ```yaml preprocessing: - version: [1, 2, 3] # Creates 3 separate deployments image: ghcr.io/loculus-project/preprocessing-nextclade - version: 4 # Creates 1 additional deployment ``` ### Screenshot <img width="1504" height="532" alt="image" src="https://github.com/user-attachments/assets/6802daab-454c-4076-af90-33488dd72d68" /> ### Manual testing I tested that the validation for duplicates works.
1 parent 53b2667 commit 0fada5c

File tree

5 files changed

+38
-13
lines changed

5 files changed

+38
-13
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- define "loculus.flattenPreprocessingVersions" -}}
2+
{{- $preprocessing := . -}}
3+
{{- $flattened := list -}}
4+
{{- $seen := dict -}}
5+
{{- range $pc := $preprocessing -}}
6+
{{- $versions := (kindIs "slice" $pc.version | ternary $pc.version (list $pc.version)) -}}
7+
{{- range $v := $versions -}}
8+
{{- if hasKey $seen (toString $v) -}}
9+
{{- fail (printf "Duplicate preprocessing pipeline version %v found in organism configuration" $v) -}}
10+
{{- end -}}
11+
{{- $_ := set $seen (toString $v) true -}}
12+
{{- $copy := deepCopy $pc -}}
13+
{{- $_ := set $copy "version" $v -}}
14+
{{- $flattened = append $flattened $copy -}}
15+
{{- end -}}
16+
{{- end -}}
17+
{{- dict "items" $flattened | toJson -}}
18+
{{- end -}}

kubernetes/loculus/templates/loculus-preprocessing-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
{{- $rawNucleotideSequences := (($organismConfig.schema | include "loculus.patchMetadataSchema" | fromYaml).nucleotideSequences) }}
44
{{- $nucleotideSequences := ($rawNucleotideSequences | default "" ) }}
55
{{- $nucleotideSequencesList := (eq $rawNucleotideSequences nil | ternary (list "main") $rawNucleotideSequences) }}
6-
{{- range $processingIndex, $processingConfig := $organismConfig.preprocessing }}
6+
{{- $flattened := include "loculus.flattenPreprocessingVersions" $organismConfig.preprocessing | fromJson }}
7+
{{- range $processingIndex, $processingConfig := $flattened.items }}
78
{{- if $processingConfig.configFile }}
89
{{- /* Use the enaDepositionConfig as the base config */}}
910
{{- $enaDepositionConfig := dig "enaDeposition" "configFile" dict $organismConfig }}

kubernetes/loculus/templates/loculus-preprocessing-deployment.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
{{- $keycloakHost := $testconfig | ternary (printf "http://%s:8083" $.Values.localHost) "http://loculus-keycloak-service:8083" }}
88
{{- if not .Values.disablePreprocessing }}
99
{{- range $organism, $organismConfig := (include "loculus.enabledOrganisms" . | fromJson) }}
10-
{{- range $processingIndex, $processingConfig := $organismConfig.preprocessing }}
10+
{{- $flattened := include "loculus.flattenPreprocessingVersions" $organismConfig.preprocessing | fromJson }}
11+
{{- range $processingIndex, $processingConfig := $flattened.items }}
1112
{{- $thisDockerTag := $processingConfig.dockerTag | default $dockerTag }}
1213
{{- $replicas := $processingConfig.replicas | default 1 }}
1314
---

kubernetes/loculus/values.schema.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,21 @@
441441
"version": {
442442
"groups": ["preprocessing"],
443443
"docsIncludePrefix": false,
444-
"type": "integer",
445-
"minimum": 1,
446-
"description": "Version of the preprocessing pipeline."
444+
"oneOf": [
445+
{
446+
"type": "integer",
447+
"minimum": 1
448+
},
449+
{
450+
"type": "array",
451+
"items": {
452+
"type": "integer",
453+
"minimum": 1
454+
},
455+
"minItems": 1
456+
}
457+
],
458+
"description": "Version of the preprocessing pipeline. Can be a single integer or an array of integers."
447459
},
448460
"image": {
449461
"groups": ["preprocessing"],

kubernetes/loculus/values.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,14 +1368,7 @@ defaultOrganisms:
13681368
<<: *defaultOrganismConfig
13691369
preprocessing:
13701370
- <<: *preprocessing
1371-
version: 1
1372-
configFile:
1373-
<<: *preprocessingConfigFile
1374-
genes: [NP, VP35, VP40, GP, sGP, ssGP, VP30, VP24, L]
1375-
nextclade_dataset_name: nextstrain/ebola/sudan
1376-
nextclade_dataset_server: https://raw.githubusercontent.com/nextstrain/nextclade_data/ebola/data_output
1377-
- <<: *preprocessing
1378-
version: 2
1371+
version: [1, 2]
13791372
configFile:
13801373
<<: *preprocessingConfigFile
13811374
genes: [NP, VP35, VP40, GP, sGP, ssGP, VP30, VP24, L]

0 commit comments

Comments
 (0)