How do I get the deployed name of the flow inside the flow?
I deploy the flow with a different name, than in the flow decorator.
The flow is shown with the modified name in Prefect cloud.
But when I run the flow, it shows me the original name instead of the modified one.
Copy code
from prefect import flow
from prefect.context import get_run_context
from prefect.deployments import Deployment, run_deployment
@flow(name="a", log_prints=True)
def my_flow_a():
# always prints "a" even if I start flow b in prefect cloud
print(get_run_context().flow.name)
my_flow_b = my_flow_a.with_options(name="b")
Deployment.build_from_flow(
flow=my_flow_b,
name="deployment",
apply=True,
)
run_deployment(name="b/deployment")
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.