Dynamically naming mapped tasks in Prefect 2.0


I have a task in my flow which dynamically spawns children and I want to name them according to the search term they take as an input.

In the Prefect 1.0 this was possible - Templating names | Prefect Docs, but I was wondering if this is possible for Prefect 2.0?

I have tried to implement a solution according to this thread - python - How to dynamically rename a task run based on passed variable from within a Prefect flow for Prefect 2.0? - Stack Overflow but I am getting a strange error:


The pipeline itself runs but the overall state becomes failed. Any help on this would be appreciated.


1 Like

Never mind, I was being an idiot. I solved by adding a None to the type hinting when defining the flow:

def complex_etl_flow() -> None:

all good, there are no silly questions! glad you figured it out :raised_hands: