Skip to content

Commit bc3afbd

Browse files
Merge pull request #23 from InformaticsMatters/sc-3447-job-compliant-variables
Job compliant variables [sc-3447]
2 parents 0f220c0 + 6143af6 commit bc3afbd

File tree

7 files changed

+16
-8
lines changed

7 files changed

+16
-8
lines changed

tests/workflow-definitions/duplicate-workflow-variable-names.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: DataManagerWorkflow
33
kind-version: "2024.1"
44
name: duplicate-workflow-variable-names
55
description: A workflow with a duplicate variable name in the input and output
6-
variables:
6+
variable-mapping:
77
inputs:
88
- name: x
99
type: squonk/x-smiles

tests/workflow-definitions/simple-python-molprops-with-options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: DataManagerWorkflow
33
kind-version: "2024.1"
44
name: python-workflow
55
description: A simple python experimental workflow
6-
variables:
6+
variable-mapping:
77
inputs:
88
- name: candidateMolecules
99
type: squonk/x-smiles

tests/workflow-definitions/simple-python-molprops.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: DataManagerWorkflow
33
kind-version: "2024.1"
44
name: python-workflow
55
description: A simple python experimental workflow
6-
variables:
6+
variable-mapping:
77
inputs:
88
- name: candidateMolecules
99
type: squonk/x-smiles

tests/workflow-definitions/simple-python-parallel.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: DataManagerWorkflow
33
kind-version: "2024.1"
44
name: python-workflow
55
description: A simple branching workflow
6-
variables:
6+
variable-mapping:
77
inputs:
88
- name: candidateMolecules
99
type: squonk/x-smiles

tests/workflow-definitions/workflow-options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: DataManagerWorkflow
33
kind-version: "2024.1"
44
name: workflow-options
55
description: Illustrate the use of workflow options
6-
variables:
6+
variable-mapping:
77
options:
88
- name: variableWithoutDefault
99
as:

workflow/decoder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def get_variable_names(definition: dict[str, Any]) -> list[str]:
6868
outputs and options. This function DOES NOT de-duplicate names,
6969
that is the role of the validator."""
7070
wf_variable_names: list[str] = []
71-
variables: dict[str, Any] | None = definition.get("variables")
71+
variables: dict[str, Any] | None = definition.get("variable-mapping")
7272
if variables:
7373
wf_variable_names.extend(
7474
input_variable["name"] for input_variable in variables.get("inputs", [])
@@ -112,7 +112,7 @@ def set_variables_from_options_for_step(
112112
assert step_name
113113

114114
result = {}
115-
options = definition.get("variables", {}).get("options", [])
115+
options = definition.get("variable-mapping", {}).get("options", [])
116116

117117
for opt in options:
118118
for step_alias in opt["as"]:
@@ -131,7 +131,7 @@ def get_required_variable_names(definition: dict[str, Any]) -> list[str]:
131131
variables that are required to be defined when it is RUN - i.e.
132132
all those the user needs to provide."""
133133
required_variables: list[str] = []
134-
variables: dict[str, Any] | None = definition.get("variables")
134+
variables: dict[str, Any] | None = definition.get("variable-mapping")
135135
if variables:
136136
# All inputs are required (no defaults atm)...
137137
required_variables.extend(

workflow/workflow-schema.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ properties:
2828
items:
2929
$ref: "#/definitions/step"
3030
variables:
31+
# A Job-compliant set of variable declarations for the workflow.
32+
# This block structure is a reproduction of that used in Job definitions
33+
# and, like JObs, has no current schema.
34+
type: object
35+
additionalProperties: false
36+
variable-mapping:
37+
# Workflow-specific variable declarations,
38+
# used (at the moment) to map workflow variables to steps.
3139
type: object
3240
additionalProperties: false
3341
properties:

0 commit comments

Comments
 (0)