How to display more descriptive task run names in the Radar view UI

If you’re looking at the radar chart, and you’re wondering what input param failed the flow, it’s hard to discern with the default naming scheme…

Original Code:

from prefect import flow, task

@task
def process(name):
    if name == "Fail":
        raise ValueError(f"Can't process Fail!")
    return "processed_{name}"


@flow()
def process_names():
    processed_names = [process(name) for name in ["Awesome", "Great", "Fail"]]
    return processed_names

process_names().result()

Fortunately, you can rename the task using with_options and now, it’s evident what param is the culprit!

from prefect import flow, task


@task
def process(name):
    if name == "Fail":
        raise ValueError(f"Can't process Fail!")
    return "processed_{name}"


@flow()
def process_names():
    processed_names = [process.with_options(name=name)(name) for name in ["Awesome", "Great", "Fail"]]
    return processed_names

process_names().result()
2 Likes