Anh Nguyen
12/19/2021, 12:47 PMAnna Geller
raise_final_state=True
Here is a full example:
from prefect import Flow
from prefect.tasks.prefect import create_flow_run, wait_for_flow_run
with Flow("flow_of_flows") as flow:
flow_run_id = create_flow_run(flow_name="x", project="community")
wait_until_this_child_flow_succeeds = wait_for_flow_run(
flow_run_id, raise_final_state=True
)
# this will only run if the flow run of flow X succeeded:
yet_another_child_flow_run_id = create_flow_run(flow_name="y", project="community")
flow_run_view_for_this_run = wait_for_flow_run(
yet_another_child_flow_run_id, raise_final_state=True
)
Note that both child flows must be registered beforehand in order to be triggered from a parent flow.