Hello! 2.0 question: I am trying to build a flow that uses other flows that have already been registered in Prefect. Is there a way to define the new flow referencing the existing flows? All the examples I have seen declare the main flow and subflows at the same time and in the same file. Thanks!
z
Zanie
05/12/2022, 8:58 PM
We don’t have great support for creating runs within a flow for deployments yet, it’s on the roadmap but there’s not a simple UX yet.
Thanks for your response! I can use the client, but I am not sure I understand how to do it. Assuming I have flow1 and flow2 with their respective deployments, how could I create a flow/deployment that runs flow1/deployment_a and flow2/deployment_b?
z
Zanie
05/12/2022, 9:08 PM
Copy code
from prefect import get_client, task
@task
async def create_flow_run_from_deployment(deployment_id):
async with get_client() as client:
await client.create_flow_run_from_deployment(deployment_id)
I’d recommend waiting until we have a first-class experience if this is confusing.
p
Paco Ibañez
05/12/2022, 9:09 PM
nice! thank you so much!
Paco Ibañez
05/12/2022, 9:10 PM
I am already using the client so I will give this approach a try
z
Zanie
05/12/2022, 9:15 PM
👍 sweet. This will create the run and an agent will have to execute it. It won’t wait for completion. To do that, you’d have to read the flow run on an interval and check the state.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.