Artem Andrienko
02/05/2020, 2:00 PMwith Flow("Data collection") as flow:
params = task(params)
another_task(**params)
but python raise an error
TypeError: FunctionTask object argument after ** must be a mapping, not FunctionTask
Is there any way to unpack dict from task?Jeremiah
02/05/2020, 3:27 PMtask(params)
inside your with Flow
block, you are not actually calling your task function quite yet. Instead, Prefect is observing that call and building up a computational graph that will be executed later. Therefore, the resulting variable that you called params
is not actually a dictionary, but a Prefect Task
object; the dictionary will not be produced until you actually call flow.run()
. What you should probably do in your flow definition is pass the entire params
variable to another_task
like this: another_task(params)
and unpack the dictionary inside the task, where you can provide any custom logic. When the flow is run, Prefect will collect the dictionary output from task
and pass it to another_task
appropriately.itay livni
02/05/2020, 3:44 PM