https://prefect.io logo
Title
d

dados grupoa

11/16/2022, 8:07 PM
Hello guys, I'm trying to migrate from prefect 1 to 2, but I can't find how to put dynamic names on tasks, it would be the equivalent of this, in prefect 1 https://docs-v1.prefect.io/core/concepts/templating.html. Can anybody help me ?
1
m

Mason Menges

11/16/2022, 10:02 PM
Hey @dados grupoa I believe you should be able to accomplish this by running the task with options something like this
from prefect import task, flow

@task
def taska():
    print("do something")


@flow
def flowa():
    taska.with_options(name="Some_custom_name")()

if __name__ == "__main__":
    flowa()
🙌 1