ambitious-air-47430
09/06/2024, 6:54 PMfrom flytekit import dynamic, task, workflow, map_task, PythonFunctionTask
@task
def t1(foo: list[int]) -> None:
for i in foo:
print(i)
@task
def t2(bar: list[int]) -> None:
for i in bar:
print(i)
@dynamic
def d1(task_function_to_map: PythonFunctionTask, l: dict[str, list[int]]) -> None:
# Do common stuff
map_task(task_function_to_map)(**l)
# Do more common stuff
@workflow
def main_wf() -> None:
d1(
task_function_to_map=t1,
l={"foo": [1, 2, 3, 4, 5, 6, 7, 8, 9]}
)
d1(
task_function_to_map=t2,
l={"bar": [1, 2, 3, 4, 5, 6, 7, 8, 9]}
)
This doesn't work as the arraynode fails to bind the variable in map task. Is there an elegant way to do this ?
thx in advancefreezing-airport-6809
freezing-airport-6809