Ofek K
05/02/2024, 12:13 PMMarvin
05/02/2024, 12:14 PMpython
from prefect import flow
import datetime
def generate_flow_run_name():
date = datetime.datetime.now(datetime.timezone.utc)
return f"flow-run-on-{date:%Y-%m-%d}"
@flow(flow_run_name=generate_flow_run_name)
def my_flow():
pass
my_flow()
This example sets the flow run name to include the current date when the flow is invoked. For more advanced scenarios where you might have access to job variables within your flow function, you could adapt this pattern to use the desired job variables for your flow run name.
For more detailed guidance and documentation on overriding job variables, you can refer to the Prefect documentation on overriding job variables.