https://prefect.io logo
#prefect-community
Title
# prefect-community
a

Ashley Felber

12/13/2022, 3:19 PM
Hello, I am trying to define dependencies between my flows in Prefect 2.0 (e.g. don't run script B until script A finishes). I am running each flow as a Fargate task. Ideally, I want to be able to continue to run the flows as separate Fargate tasks but still define dependencies. The only method i've seen in the documentation is using sub flows. But I think in this case, all flows would need to be run from 1 image. Is there a recommendation on how to define dependencies while still building separate images/tasks?
1
n

Nate

12/13/2022, 3:56 PM
Hi @Ashley Felber, it sounds like you might want to leverage
run_deployment
(docs) where you can build a deployment for A and B (using whatever infrastructure / image you want for either) and then write something like
Copy code
from prefect.deployments import run_deployment

@flow
def orchestrator_flow():
   A_flow_run_model = run_deployment(name="DeploymentA", parameters={"Marvin": 42})

   if A_flow_run_model.state.name = "Completed": # or however you want to respond to state changes
      B_flow_run_model = run_deployment(name="DeploymentB", parameters={"Alice": "Bob"})
where the flow runs for A and B will become subflow runs of
orchestrator_flow
because that's where they're called from
🙌 1
a

Ashley Felber

12/13/2022, 4:09 PM
Awesome thank you!