(copying this question from #C04E1CKG456 per request from @Will Raphaelson)
Is there any way to get the parent flow of a subflow? I just started using subflows, and
{{ deployment.name }}
is blank when the flow is a subflow - ideally in the automation whisker template I could check if a flow was really a subflow, and then get the subflow name and the parent deployment name. Any tips? I’ve been fiddling with
get_run_context
and
prefect.runtime
but I don’t see anything that can be used to 1) check if a flow is really a subflow, and 2) if a flow is a subflow, get the parent deployment name
Clearly there is a way to do it since the Prefect UI has this logic as i toggle through pages, but I don’t see a clear way to get that same information with the prefect python library
✅ 1
scott
04/04/2023, 6:53 PM
Will responded that the parent flow info isn’t available right now in the jinja environment. And that a subflow is really just a flow from the client perspective
scott
04/04/2023, 6:54 PM
I’m guessing this is a situation in which one needs to use the prefect REST API to get parent info (assuming you’re not the prefect UI)
w
Will Raphaelson
04/05/2023, 4:40 PM
Thanks scott, talked to some colleagues and we agree we should add this to the prefect runtime. I’ve filed at least one part of it here, and talking through adding in deployment information as well
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.