Matthew Seligson
02/04/2022, 6:41 PMAnna Geller
Flow run created: <https://cloud.prefect.io/anna-prefect/flow-run/d3f27dd8-1e5e-40af-94cf-46766ef080f3>
Having said that, we know this link between parent and child flow run could be improved and Orion provides a first-class way to navigate between parent and child flows. If you are interested to learn more, check out this livestream recording: from prefect import Flow
from prefect.tasks.prefect import create_flow_run, wait_for_flow_run
with Flow("parent_flow") as flow:
child_flow_run_id = create_flow_run(
flow_name="child_flow_name", run_name="custom_run_name"
)
child_flowrunview = wait_for_flow_run(
child_flow_run_id, raise_final_state=True, stream_logs=True
)
But note that this is not available in the StartFlowRun task.
For more, see this Discourse topicMatthew Seligson
02/04/2022, 7:16 PMKevin Kho
Anna Geller
from prefect import flow
import time
@flow
def subflow(x):
print("I am a subflow - waiting for 5 seconds to show some processing!")
time.sleep(5)
return x
@flow
def second_subflow(x):
print("I am a second subflow!")
return x
@flow
def main_flow():
data = subflow(5)
second_subflow(data)
if __name__ == "__main__":
main_flow()