https://prefect.io logo
Title
s

scott

04/04/2023, 6:52 PM
(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
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
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
🎉 2
Once this is there, there will still be some work to pass this through to the jinja template. lets hack on it together when we get that?
s

scott

04/05/2023, 6:48 PM
Great, sounds good. Happy to help with the jinja templating