https://prefect.io logo
Title
v

Vadym Dytyniak

11/10/2022, 3:01 PM
Hi. Is it possible in Prefect 2 to name the task based on input parameters? https://docs-v1.prefect.io/core/idioms/task-run-names.html
1
b

Bianca Hoch

11/10/2022, 3:06 PM
Hi Vadym, here is an article that may be helpful for your use case
You can rename a task using
with_options
and pass in the parameters you would like displayed in the name
v

Vadym Dytyniak

11/10/2022, 3:10 PM
Thanks, let me try
It worked! Thanks again.
🚀 2
2
k

Khuyen Tran

11/10/2022, 4:08 PM
@terrence I saw several people asked about this.
with_options
is only available in API. I wonder if we can add this under Concepts/Tasks? I can work on adding it
👍 1
1
t

terrence

11/10/2022, 4:15 PM
Yep I’ll look into getting this incorporated.
:gratitude-thank-you: 2
k

Khuyen Tran

11/10/2022, 4:20 PM
Let me know if I can help in anyway
l

Leonardus Chen

01/27/2023, 3:08 AM
Is it possible to make this work with
task.map
?
@task
def say_hello(name: str) -> None:
    print(name)
This works
names = ["a", "b"]
for name in names:
    say_hello.with_options(name=f"say {name}"}
Is it possible to make it work with
names = ["a", "b"]
say_hello.map(names)
Bumping this up
z

Zanie

01/31/2023, 4:37 PM
We don’t support changing options on mapped tasks yet, we’re thinking about a nice way to expose this though.