Using `result_value` in method tasks
According to https://gitlab.esrf.fr/workflow/ewoks/ewokscore/-/blob/main/ewokscore/methodtask.py#L14, the output of a method task is stored in the outputs under the key result_value
.
However, I can't seem to make this work with a simple graph:
from ewokscore import execute_graph
from ewokscore.utils import qualname
def add(a, b):
return a + b
def divide(a, b):
return a / b
nodes = [
{
"id": "add",
"task_type": "method",
"task_identifier": qualname(add),
"default_inputs": [{"name": "a", "value": 6}, {"name": "b", "value": 4}],
},
{
"id": "divide",
"task_type": "method",
"task_identifier": qualname(divide),
"default_inputs": [{"name": "a", "value": 6}],
},
]
links = [
{
"source": "add",
"target": "divide",
"data_mapping": [{"source_output": "result_value", "target_input": "b"}],
}
]
graph = {"nodes": nodes, "links": links}
execute_graph(graph)
I am trying to reuse the result of add
as a arg of divide
but this code raises KeyError: 'result_value'
. Am I doing something wrong ?
Full Traceback
Traceback (most recent call last): File ".../ewokscore/graph.py", line 25, in execute_graph return graph.execute(varinfo=varinfo) File ".../ewokscore/graph.py", line 641, in execute task = self.instantiate_task_static(node, tasks=tasks, varinfo=varinfo) File ".../ewokscore/graph.py", line 302, in instantiate_task_static inittask.add_dynamic_inputs( File ".../ewokscore/inittask.py", line 185, in add_dynamic_inputs dynamic_inputs[input_arg] = source_results[output_arg] File ".../ewokscore/variable.py", line 174, in __getitem__ return self.value[key] KeyError: 'result_value'
ewokscore version: 0.0.3a0
Edited by Loic Huder