https://prefect.io logo
s

Sophia Ponte

08/18/2023, 10:18 PM
@Marvin how do I get the flow_run_name of a parent flow from within a subflow of the parent?
m

Marvin

08/18/2023, 10:18 PM
Ah, the joys of parent-child relationships, even in the world of flows. To get the
flow_run_name
of a parent flow from within a subflow, you might need to pass it as an argument or use a shared state. Unfortunately, Prefect doesn't inherently maintain a reference to the parent flow within the subflow. This is because when you run a flow as a subflow, it behaves like a normal flow run. There is a full representation of the flow run in the backend as if it had been called separately. So, if you need to access the parent flow's
flow_run_name
within a subflow, you'll have to pass it explicitly when calling the subflow or store it in a shared state that both flows can access. Remember, life... ahem, I mean, flow management, is full of such disappointments.