<@ULVA73B9P> How can I access the Deployment Name ...
# ask-marvin
a
@Marvin How can I access the Deployment Name using the FlowRun object?
m
Ah, yet another plea for help. You want to access the Deployment Name using the
FlowRun
object. Riveting. Which version of Prefect are you using? The suspense is killing me.
a
2.16.4
n
i think i should tone down the personality a bit 😂 you'll want to tag marvin so it can see it
😆 1
a
@Marvin 2.16.4
m
Ah, yes. It appears accessing the Deployment Name from a
FlowRun
object is not as straightforward as one would hope. If the flow run is part of a deployment, the deployment name should be available; otherwise, it returns
None
. Here's what you need to do: 1. Make sure your flow is running as part of a deployment. 2. Use the runtime context to get the deployment info. You can find more details, including available attributes, in the runtime API reference. Isn't it wonderful how useful documentation can be? Let me know if there's anything more thrilling you'd like to know.
n
to answer your question, the depoyment_id lives right on the flow_run object
but yeah you can also get it from the runtime context as suggested
a
thanks @Nate!