Check tests/library/test_map_workflow.py: test_map_explicit_map_on
Not sure but seems to have an issue in tests/library/test_map_workflow.py: test_map_explicit_map_on
map_on={"out_array", "out"} is viewed as a set not a dict and therefore library/workflows/base_map_workflow.py", line 115 failed with items method
for upstream_output_name, input_name in self.map_on.items(): AttributeError: 'set' object has no attribute 'items'
Should be map_on={"out_array": "out"}
def test_map_explicit_map_on(self):
@as_task
def SimpleTaskMultipleInputs(out: int, other: int) -> {"value": int}:
return {"value": 0}
class MapCommand(Command):
def setup_tasks(self):
generator = Generator()
with MapWorkflow(
raise_exceptions=True,
flatten_output=True,
map_on={"out_array", "out"},
) as m:
BTW, a short example in the docs should be welcomed
Since GenData has only one output and Transform has only one output, MapWorkflow knows it has to split the output of GenData and each item is the input of each executed workflow. If GenData had more than one output, or Transform more than one input, we would have to specify how to split the inputs of the MapWorkflow using the map_on argument of the decorator. It takes a dictionnary, key is the name of the input sequence, and the value is the name of the target input of the first task of the workflow that will receive each item of the sequence.
@as_task
def SimpleTaskMultipleInputs(out: int, other: int) -> {"value": int}:
return {"value": 0}
class MapCommand(Command):
def setup_tasks(self):
generator = Generator()
with MapWorkflow(
raise_exceptions=True,
flatten_output=True,
map_on={"out_array": "out"},
) as m: