Sébastien
12/09/2020, 11:46 AMtask2.set_upstream(task1)
to manually create a dependency, but that gives me:
/usr/local/lib/python3.7/dist-packages/prefect/core/task.py:596: UserWarning: You are making a copy of a task that has dependencies on or to other tasks in the active flow context. The copy will not retain those dependencies.
What's the right way to say (in functional API) that task2 can only run after task1 was completed, without messing up the flow?
The entire flow:
schedule = CronSchedule("0 * * * *", start_date=datetime.now())
with Flow("Q", schedule=schedule) as flow:
task2.set_upstream(task1)
task1()
some_result = task2()
task3(some_result)
josh
12/09/2020, 1:56 PMwith Flow("Q", schedule=schedule) as flow:
task_1 = task1()
some_result = task2()
some_result.set_upstream(task_1)
task3(some_result)
Sébastien
12/09/2020, 1:57 PMtask
have set_upstream
rather than the result of a task?josh
12/09/2020, 1:59 PMwith Flow("Q", schedule=schedule) as flow:
task_1 = task1()
task_2 = task2()
task_2.set_upstream(task_1)
task3(task_2)
Calling task3(task2)
is a shorthand way of passing the result of task2 into task3 (and thus making is an upstream task). Calling task_2.set_upstream(task_1)
is setting the upstream directly without passing any data.Sébastien
12/09/2020, 2:01 PMtask_2
and task2
tasks?Task
is @task
, which is task2
but not task_2
josh
12/09/2020, 2:03 PMSébastien
12/09/2020, 2:04 PM