<@ULVA73B9P> what is the format of the deployment ...
# ask-marvin
a
@Marvin what is the format of the deployment name returned by the prefect runtime in a flow?
m
thought for 58.2 seconds
In Prefect 3.x,
prefect.runtime.deployment.name
returns just the deployment name as a string. So if your deployment is named
my-deployment
, this:
Copy code
python
from prefect.runtime import deployment

print(deployment.name)
returns:
Copy code
python
my-deployment
It does not return a combined value like
flow-name/my-deployment
. A couple notes: - Type:
Optional[str]
- If the flow run is not associated with a deployment, it can be
None
Related runtime attribute: -
prefect.runtime.flow_run.name
gives the flow run name, which is different -
prefect.runtime.deployment.id
gives the deployment ID Docs: - Runtime context docs If you want, I can also show how to get both the flow name and deployment name together inside a running flow.