https://prefect.io logo
Title
a

Aleksandr Liadov

12/15/2022, 10:16 AM
Hello Prefects, I’am switching from Prefect 1 to 2 one. And I’m blocked with the DAG free conception. One part of my flow is predefined rigid DAG. How can I achieve “dag behavior” in Prefect 2? Toy example of my graph:
graph = {
  "feature_1" : [],
  "feature_2" : [],
  "feature_3" : ["feature_1", "feature_2"],
  "feature_4" : ["feature_3"],
  "feature_5" : ["feature_4"],
}
So how can I “explain” that in the first time we can run in parallel
feature_1
and
feature_2
, but not the others one. We can run
feature_3
, only when
feature_1
and
feature_2
was successfully executed, and feature_3 take like input parameters the results of
feature_1
and
feature_2
. P.S. In production it should be run with
DaskTaskRunner
. Could be there any difficulty?
m

Mike O'Connor

12/15/2022, 11:52 AM
look at this section of the docs, specifically
submit
and
result
. you may also find wait_for useful.
🙌 1
a

Aleksandr Liadov

12/15/2022, 5:09 PM
@Zanie I have found your code example here: https://prefect-community.slack.com/archives/CL09KU1K7/p1665424063672229?thread_ts=1665419812.995289&cid=CL09KU1K7 Unfortunately, It doesn’t execute features in the graph specified order. Moreover it pass
prefect.tasks.Task object
instead of
PrefectFuture
:(
k

Khuyen Tran

12/16/2022, 4:56 PM
@Aleksandr Liadov I’m curious if you have tried to incorporate
wait_for
and
submit
to your code?
a

Aleksandr Liadov

12/21/2022, 4:40 PM
For someone who will be blocked with the same problem, the solution: https://discourse.prefect.io/t/how-to-define-dag-like-flow-in-prefect-2-0/2069/7