<@ULVA73B9P> is it possible to custom the name of ...
# ask-marvin
e
@Marvin is it possible to custom the name of a flow run in the Prefect UI?
m
thought for 49.6 seconds
Yes, it's definitely possible to customize the name of a flow run in the Prefect UI! Let me show you the different ways you can do this. 1. Static Flow Run Name
Copy code
python
from prefect import flow

@flow(flow_run_name="My Custom Flow Run")
def my_flow():
    pass
2. Dynamic Flow Run Name using a Function
Copy code
python
from prefect import flow
from datetime import datetime

def generate_flow_run_name():
    return f"My Flow Run - {datetime.utcnow().strftime('%Y-%m-%d-%H-%M')}"

@flow(flow_run_name=generate_flow_run_name)
def my_flow():
    pass
3. Dynamic Flow Run Name using Flow Parameters
Copy code
python
from prefect import flow

@flow(flow_run_name="{name}-{date}")
def my_flow(name: str, date: str):
    pass

# When called like this:
my_flow("test", "2023-12-01")
# The flow run will be named: "test-2023-12-01"
The
flow_run_name
parameter can be: - A static string - A callable (function) that returns a string - A template string that uses flow input parameters This feature is particularly useful when you want to: - Track specific runs more easily in the UI - Differentiate between multiple runs of the same flow - Include meaningful metadata in the run name (like timestamps, parameters, or environment information) You can find more details about customizing flow metadata in the Prefect documentation.