Is there a way to create a task that's reused with different parameters, that for each use is given a different name that then appears in the schematic visualization? I thought that doing
@task(task_run_name="{name_val}")
and then passing in a name_val variable would do it, but in the dashboard everything is still showing up as the name of the function definition
k
Kevin Kho
08/04/2021, 4:21 PM
Hey @Harry Baker, I’ll try this myself
Kevin Kho
08/04/2021, 4:30 PM
I think I know what you’re saying. There are two schematics in the
Flow Schematic
and the
Flow Run Schematic
. The Flow Schematic is created during build time when the template values are not there yet, so of course it can’t reflect the templated name. But the
Flow Run Schematic
will. Here is a sample flow:
Copy code
from prefect import task, Flow
@task(task_run_name="{name_val}")
def test(x, name_val):
return x + 1
with Flow("task_name") as flow:
test(1, name_val="test1")
test(2, name_val="test2")
test(3, name_val="test3")
test(4, name_val="test4")
flow.register("dremio")
Kevin Kho
08/04/2021, 4:32 PM
If you go to the Flow Run page, the schematic will reflect “test1”, “test2", “test3”, “test4"
h
Harry Baker
08/04/2021, 4:32 PM
oh, I see. is there any way to have the names correctly show up in the flow schematic, or would this require custom defining specific tasks
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.