Skip to content

Commit b9eaf02

Browse files
Merge branch 'main' of github.com:fair-workflows/fairworkflows into fix-retrospective-logging
Conflicts: fairworkflows/fairworkflow.py
2 parents 444c721 + 0efbe14 commit b9eaf02

2 files changed

Lines changed: 2 additions & 35 deletions

File tree

fairworkflows/fairworkflow.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -379,38 +379,15 @@ def execute(self, *args, **kwargs):
379379

380380
LOGGER.setLevel(logging.INFO)
381381
LOGGER.handlers = [log_handler]
382-
self.workflow_level_promise = self._replace_input_arguments(self.workflow_level_promise,
383-
args, kwargs)
382+
self.workflow_level_promise = noodles.workflow.from_call(
383+
noodles.get_workflow(self.workflow_level_promise).root_node.foo, args, kwargs, {})
384384
result = noodles.run_single(self.workflow_level_promise)
385385

386386
# Generate the retrospective provenance as a (nano-) Publication object
387387
retroprov = self._generate_retrospective_prov_publication(log.getvalue())
388388

389389
return result, retroprov
390390

391-
def _replace_input_arguments(self, promise: noodles.interface.PromisedObject, args, kwargs):
392-
"""
393-
Replace the input arguments of the promise so we can run the workflow with the right
394-
inputs. This goes into the guts of noodles, doing something noodles was not intended to be
395-
used for.
396-
TODO: find a better solution for this
397-
"""
398-
workflow = noodles.get_workflow(promise)
399-
signature = inspect.signature(workflow.root_node.foo)
400-
arguments_dict = self._get_arguments_dict(args, kwargs, signature)
401-
workflow.root_node.bound_args = inspect.BoundArguments(signature, arguments_dict)
402-
return promise
403-
404-
@staticmethod
405-
def _get_arguments_dict(args, kwargs, signature):
406-
"""
407-
Create dictionary of keyword arguments from positional and keyword arguments and the
408-
signature of the function.
409-
"""
410-
arguments_dict = {key: arg for arg, key in zip(args, signature.parameters.keys())}
411-
arguments_dict.update(kwargs)
412-
return arguments_dict
413-
414391
def _generate_retrospective_prov_publication(self, log:str) -> nanopub.Publication:
415392
"""
416393
Utility method for generating a Publication object for the retrospective

tests/test_fairworkflow.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -379,16 +379,6 @@ def process_image(im: OtherType):
379379
assert result.message == obj.message
380380
assert isinstance(prov, Publication)
381381

382-
def test_get_arguments_dict(self):
383-
args = (1, 2)
384-
kwargs = {'c': 3, 'd': 4}
385-
386-
def func(a, b, c, d):
387-
return
388-
389-
result = FairWorkflow._get_arguments_dict(args, kwargs, inspect.signature(func))
390-
assert result == {'a': 1, 'b': 2, 'c': 3, 'd': 4}
391-
392382
def test_workflow_non_decorated_step(self):
393383
def return_value(a: float) -> float:
394384
"""Return the input value. NB: no is_fairstep decorator!"""

0 commit comments

Comments
 (0)