https://prefect.io logo
e

Edmondo Porcu

08/11/2022, 11:36 PM
What is the difference between flow.set_dependency and flow.add_edge in Prefect 1.0?
a

Anna Geller

08/12/2022, 12:48 AM
ideally, don't use any of those 😂 those are for the imperative API, which no longer exists in Prefect 2.0 - the default Prefect version now the right way to set dependencies for tasks that don't pass data is: • 1.0 - upstrea_tasks argument • 2.0 - wait_for the docs.prefect.io + docs-v1.prefect.io will show more info
e

Edmondo Porcu

08/12/2022, 1:13 AM
thank you
When you use the @task annotation is not obvious to me how to use the upstream task
a

Anna Geller

08/12/2022, 10:37 AM
below this line https://gist.github.com/edmondo1984/61a805b170ebed4bcb7d3ee3a84b7a2d#file-runner-py-L115 I would add a line
upstream_tasks=[setup_task]
you don't need to wrap that in build_flow, I'd encourage taking it out
e

Edmondo Porcu

08/12/2022, 4:52 PM
I am not sure I understood that, can you please clarify? This is very useful
a

Anna Geller

08/12/2022, 5:50 PM
I'd encourage you to check the getting started guide: https://docs-v1.prefect.io/core/concepts/tasks.html even though at this point, starting with 2.0 makes more sense https://orion-docs.prefect.io/
10 Views