Skip to content

Commit 8d05f15

Browse files
author
Alan Christie
committed
fix: No longer need realise-outputs
1 parent c2eb21c commit 8d05f15

File tree

6 files changed

+6
-90
lines changed

6 files changed

+6
-90
lines changed

tests/test_decoder.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -197,42 +197,6 @@ def test_get_workflow_steps():
197197
assert steps[1]["name"] == "step2"
198198

199199

200-
def test_get_workflow_outputs_for_step_with_name_step1():
201-
# Arrange
202-
203-
# Act
204-
has_outputs = decoder.workflow_step_has_outputs(
205-
_SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW, "step1"
206-
)
207-
208-
# Assert
209-
assert not has_outputs
210-
211-
212-
def test_get_workflow_outputs_for_step_with_name_step2():
213-
# Arrange
214-
215-
# Act
216-
has_outputs = decoder.workflow_step_has_outputs(
217-
_SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW, "step2"
218-
)
219-
220-
# Assert
221-
assert has_outputs
222-
223-
224-
def test_get_workflow_outputs_for_step_with_unkown_step_name():
225-
# Arrange
226-
227-
# Act
228-
has_outputs = decoder.workflow_step_has_outputs(
229-
_SIMPLE_PYTHON_MOLPROPS_WITH_OPTIONS_WORKFLOW, "unknown"
230-
)
231-
232-
# Assert
233-
assert not has_outputs
234-
235-
236200
def test_get_step_input_variable_names_when_duplicates():
237201
# Arrange
238202
workflow_filename: str = os.path.join(

tests/test_workflow_validator_for_run_level.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def test_validate_simple_python_molprops_with_options_when_missing_required():
156156
)
157157

158158
# Assert
159-
assert error.error_num == 7
159+
assert error.error_num == 8
160160
assert error.error_msg == [
161161
"Missing workflow variable values for: rdkitPropertyValue"
162162
]
@@ -210,7 +210,7 @@ def test_validate_simple_python_molprops_with_missing_input():
210210
)
211211

212212
# Assert
213-
assert error.error_num == 7
213+
assert error.error_num == 8
214214
assert error.error_msg == [
215215
"Missing workflow variable values for: candidateMolecules"
216216
]

workflow/decoder.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,6 @@ def get_step_input_variable_names(
108108
return variable_names
109109

110110

111-
def workflow_step_has_outputs(definition: dict[str, Any], name: str) -> bool:
112-
"""Given a Workflow definition and a step name we return a boolean
113-
that is true if the step produces outputs. This requires inspection
114-
of the 'as-yet-unused' variables block."""
115-
return (
116-
len(get_step_output_variable_names(definition=definition, step_name=name)) > 0
117-
)
118-
119-
120111
def set_step_variables(
121112
*,
122113
workflow: dict[str, Any],

workflow/workflow_abc.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -373,16 +373,6 @@ def get_running_workflow_step_output_values_for_output(
373373
# "output": ["dir/file1.sdf", "dir/file2.sdf"]
374374
# }
375375

376-
@abstractmethod
377-
def realise_outputs(
378-
self, *, running_workflow_step_id: str
379-
) -> tuple[dict[str, Any], int]:
380-
"""Copy (link) the step's files as outputs into the Project directory."""
381-
# Should return an empty map or:
382-
# {
383-
# "error": "<error message>",
384-
# }
385-
386376

387377
class MessageDispatcher(ABC):
388378
"""The class handling the sending of messages (on the Data Manager message bus)."""

workflow/workflow_engine.py

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import logging
2626
import sys
27-
from http import HTTPStatus
2827
from pprint import pprint
2928
from typing import Any, Dict, Optional
3029

@@ -44,7 +43,6 @@
4443
get_step_input_variable_names,
4544
get_step_replicator,
4645
set_step_variables,
47-
workflow_step_has_outputs,
4846
)
4947

5048
_LOGGER: logging.Logger = logging.getLogger(__name__)
@@ -250,44 +248,17 @@ def _handle_pod_message(self, msg: PodMessage) -> None:
250248
self._set_step_error(step_name, r_wfid, r_wfsid, exit_code, "Job failed")
251249
return
252250

253-
# If we get here the prior step completed successfully and we can decide
254-
# whether the step has outputs (files) that need to be written to the
255-
# Project directory, while also marking the Step as DONE (successfully).
256-
# We pass the outputs to the DM via a call to the API adapter's realise_outputs().
257-
# In return it copies (links) these files to the Project directory.
251+
# If we get here the prior step completed successfullyso we
252+
# mark the Step as DONE (successfully).
258253
wfid = rwf_response["workflow"]["id"]
259254
assert wfid
260255
wf_response, _ = self._wapi_adapter.get_workflow(workflow_id=wfid)
261256
_LOGGER.debug("API.get_workflow(%s) returned: -\n%s", wfid, str(wf_response))
262257

263-
error_num: int | None = None
264-
error_msg: str | None = None
265-
if workflow_step_has_outputs(wf_response, step_name):
266-
# The step produces at least one output.
267-
# Inform the DM so it can link them to the Project directory
268-
response, status_code = self._wapi_adapter.realise_outputs(
269-
running_workflow_step_id=r_wfsid,
270-
)
271-
if status_code != HTTPStatus.OK:
272-
error_num = status_code
273-
error_msg = (
274-
response["error"]
275-
if "error" in response
276-
else "Undisclosed error when realising outputs"
277-
)
278-
279-
if error_num is not None:
280-
# The job was successful but linking outputs (back to the Project directory)
281-
# appears to have failed.
282-
self._set_step_error(step_name, r_wfid, r_wfsid, error_num, error_msg)
283-
return
284-
285258
# We then inspect the Workflow to determine the next step.
286259
self._wapi_adapter.set_running_workflow_step_done(
287260
running_workflow_step_id=r_wfsid,
288-
success=error_num is None,
289-
error_num=error_num,
290-
error_msg=error_msg,
261+
success=True,
291262
)
292263

293264
# We have the step from the Instance that's just finished,

workflow/workflow_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def _validate_run_level(
153153
)
154154
if missing_values:
155155
return ValidationResult(
156-
error_num=7,
156+
error_num=8,
157157
error_msg=[
158158
f"Missing workflow variable values for: {', '.join(missing_values)}"
159159
],

0 commit comments

Comments
 (0)