Commit d1aca94b authored by Wout De Nolf's avatar Wout De Nolf
Browse files

fixup

parent 6e4dae58
......@@ -3,15 +3,11 @@ from esrftaskgraph.utils import import_method
class MethodExecutorTask(Task, input_names=["method"], output_names=["return_value"]):
@property
def method(self):
fullname = self.inputs.method
return import_method(fullname)
def process(self):
method_kwargs = self.input_values
method_kwargs.pop("method")
fullname = method_kwargs.pop("method")
method = import_method(fullname)
result = self.method(**method_kwargs)
result = method(**method_kwargs)
self.outputs.return_value = result
......@@ -9,21 +9,22 @@ class PpfMethodExecutorTask(
output_names=["ppfdict"],
):
"""Ppf workflows pass one dictionary around between tasks and this dictionary
gets updates by each task.
gets updates by each task. This dictionary is unpacked into the unexpected
arguments and passed to the method.
"""
def process(self):
ppfdict = self.input_values
fullname = ppfdict.pop("method")
method_kwargs = self.input_values
fullname = method_kwargs.pop("method")
method = import_method(fullname)
ppfdict_unpack = ppfdict.pop("ppfdict", None)
if ppfdict_unpack:
ppfdict.update(ppfdict_unpack)
ppfdict = method_kwargs.pop("ppfdict", None)
if ppfdict:
method_kwargs.update(ppfdict)
result = method(**ppfdict)
result = method(**method_kwargs)
ppfdict.update(result)
self.outputs.ppfdict = ppfdict
method_kwargs.update(result)
self.outputs.ppfdict = method_kwargs
class PpfPortTask(
......@@ -32,10 +33,10 @@ class PpfPortTask(
"""A ppfmethod which represents the identity mapping"""
def process(self):
ppfdict = self.input_values
ppfdict.pop("ppfport") # not used
ppfdict_unpack = ppfdict.pop("ppfdict", None)
if ppfdict_unpack:
ppfdict.update(ppfdict_unpack)
method_kwargs = self.input_values
method_kwargs.pop("ppfport") # not used
ppfdict = method_kwargs.pop("ppfdict", None)
if ppfdict:
method_kwargs.update(ppfdict)
self.outputs.ppfdict = ppfdict
self.outputs.ppfdict = method_kwargs
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment