Abhishek
09/02/2021, 7:19 AMflow.register()
I looked into the documentation but couldn’t find it.Greg Roche
09/02/2021, 9:08 AMflow.register()
because you're wanting to set a flow run name (not the flow name). Flows are registered once and then can be run an arbitrary number of times afterwards, each run would get a different name.
To specify the flow run name you could:
• provide the name in the UI when starting a new run;
• provide the name as a parameter when running the CLI or with a GraphQL mutation (https://docs.prefect.io/orchestration/flow-runs/creation.html#flow-run-names)
• use prefect.tasks.prefect.StartFlowRun
or prefect.tasks.prefect.create_flow_run
and provide the run_name
parameter: https://docs.prefect.io/api/latest/tasks/prefect.html#startflowrunRobert Hales
09/02/2021, 9:30 AMRobert Hales
09/02/2021, 9:31 AM@task
def rename_flow_task(name: str):
flow_run_id = prefect.context.get("flow_run_id")
client = prefect.Client()
return client.set_flow_run_name(flow_run_id, name)
Abhishek
09/02/2021, 10:25 AM