Tinh
10/29/2025, 10:41 AMtask name or flow name on the UI?
it always appears with smt like: my-task-3dacMarvin
10/29/2025, 10:41 AMMarvin
10/29/2025, 10:49 AMflow_run_name on the @flow decorator
- Task runs: set task_run_name on the @task decorator
You can use:
- A static string
- A format string that references parameters by name
- A callable to build the name dynamically
Examples
from prefect import flow, task
# Static run names (no suffixes)
@flow(flow_run_name="daily-sync")
def sync_flow():
...
@task(task_run_name="load-users")
def load_users():
...
# Use flow parameters in the flow run name
@flow(flow_run_name="ingest-{customer_id}")
def ingest_flow(customer_id: str):
...
# Use task parameters in the task run name
@task(task_run_name="transform-{table}")
def transform(table: str):
...
# Build names via callables
from prefect import runtime
@flow(flow_run_name=lambda: f"backfill-{runtime.flow_run.parameters['date']}")
def backfill(date: str):
...
@task(task_run_name=lambda params: f"normalize-{params['entity']}")
def normalize(entity: str):
...
Notes
- The name argument controls the definition name (e.g., how the task/flow is labeled in the graph), while `flow_run_name`/`task_run_name` control the run name shown in the UI. If you only set name, you’ll still see a run name with a suffix unless you set *_run_name.
- If you already set a run name and still see a suffix, share a minimal snippet and your Prefect version—I’ll help debug.