Skip to content

Commit 1d22716

Browse files
author
Alan Christie
committed
feat: Removed 'as' from workflow mapping output declaration
1 parent 27c5a83 commit 1d22716

13 files changed

+17
-40
lines changed

tests/test_decoder.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,37 +317,36 @@ def test_get_workflow_outputs_for_step_with_name_step1():
317317
# Arrange
318318

319319
# Act
320-
outputs = decoder.get_workflow_output_values_for_step(
320+
has_outputs = decoder.workflow_step_has_outputs(
321321
_SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW, "step1"
322322
)
323323

324324
# Assert
325-
assert not outputs
325+
assert not has_outputs
326326

327327

328328
def test_get_workflow_outputs_for_step_with_name_step2():
329329
# Arrange
330330

331331
# Act
332-
outputs = decoder.get_workflow_output_values_for_step(
332+
has_outputs = decoder.workflow_step_has_outputs(
333333
_SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW, "step2"
334334
)
335335

336336
# Assert
337-
assert len(outputs) == 1
338-
assert "clustered-molecules.smi" in outputs
337+
assert has_outputs
339338

340339

341340
def test_get_workflow_outputs_for_step_with_unkown_step_name():
342341
# Arrange
343342

344343
# Act
345-
outputs = decoder.get_workflow_output_values_for_step(
344+
has_outputs = decoder.workflow_step_has_outputs(
346345
_SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW, "unknown"
347346
)
348347

349348
# Assert
350-
assert not outputs
349+
assert not has_outputs
351350

352351

353352
def test_get_step_input_variable_names_when_duplicates():

tests/test_test_api_adapter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ def test_basic_realise():
450450
# Act
451451
response, _ = utaa.realise_outputs(
452452
running_workflow_step_id="r-workflow-step-00000000-0000-0000-0000-000000000001",
453-
outputs=["a.txt"],
454453
)
455454

456455
# Assert

tests/wapi_adapter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,7 @@ def get_running_workflow_step_outputs(
398398
return {"outputs": []}, HTTPStatus.OK
399399

400400
def realise_outputs(
401-
self, *, running_workflow_step_id: str, outputs: list[str, str]
401+
self, *, running_workflow_step_id: str
402402
) -> tuple[dict[str, Any], int]:
403403
del running_workflow_step_id
404-
del outputs
405404
return {}, HTTPStatus.OK

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ variable-mapping:
1111
from:
1212
step: step-2
1313
output: outputFile
14-
as: clustered-molecules.smi
1514

1615
steps:
1716

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ variable-mapping:
1111
from:
1212
step: step2
1313
output: outputFile
14-
as: clustered-molecules.smi
1514

1615
steps:
1716

tests/workflow-definitions/replicate-using-undeclared-input.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ variable-mapping:
1111
from:
1212
step: step2
1313
output: outputFile
14-
as: clustered-molecules.smi
1514

1615
steps:
1716

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ variable-mapping:
6161
from:
6262
step: step2
6363
output: outputFile
64-
as: clustered-molecules.smi
6564
options:
6665
- name: rdkitPropertyName
6766
default: name

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ variable-mapping:
1111
from:
1212
step: step2
1313
output: outputFile
14-
as: clustered-molecules.smi
1514

1615
steps:
1716

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ variable-mapping:
1111
from:
1212
step: final-step
1313
output: outputFile
14-
as: clustered-molecules.smi
1514

1615

1716
steps:

workflow/decoder.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,14 @@ def get_workflow_job_input_names_for_step(
132132
return inputs
133133

134134

135-
def get_workflow_output_values_for_step(
136-
definition: dict[str, Any], name: str
137-
) -> list[str]:
138-
"""Given a Workflow definition and a step name we return a list of workflow
139-
out variable names the step creates. To do this we iterate through the workflows's
140-
outputs to find those that are declared 'from' our step."""
135+
def workflow_step_has_outputs(definition: dict[str, Any], name: str) -> bool:
136+
"""Given a Workflow definition and a step name we return a boolean
137+
that is true if the step produces outputs."""
141138
wf_outputs = definition.get("variable-mapping", {}).get("outputs", {})
142-
outputs: list[str] = []
143-
outputs.extend(
144-
output["as"]
139+
return any(
140+
"from" in output and "step" in output["from"] and output["from"]["step"] == name
145141
for output in wf_outputs
146-
if "from" in output
147-
and "step" in output["from"]
148-
and output["from"]["step"] == name
149142
)
150-
return outputs
151143

152144

153145
def set_variables_from_options_for_step(

0 commit comments

Comments
 (0)