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()
3 Likes

Is it possible to achieve the effect for all tasks in the flow, without resorting to with_options? In my case, I have daily runs for the current and the previous day, and would like to “stamp” all subflows and tasks with the date, so it’s easily discernible from the UI what has failed.

Interesting, perhaps a custom notification would be better to address that problem?

You could send an alert to Slack, email or any other notification service to notify you about that failure.

For now, the with_options is the only way to rename a task run