https://prefect.io logo
Title
n

Nick DeCraene

09/28/2022, 8:45 PM
hi there, in prefect 1.0 we could dynamically assign the task names with input params, something like:
@task(name="extract(ctx.id)")
def extract(ctx):
These would then be displayed in the UI as
extract(4)
for example if our flow was running for ctx.id=4. I haven't been able to find anything like this for 2.0, am I just missing something?
1
m

Mason Menges

09/28/2022, 9:06 PM
Hey @Nick DeCraene you should be able to accomplish this by running a task with options. so something like this
@flow(name="test")
async def test_flow(some_obj):

ta = await taskA.with_options(name=some_obj)(some_obj=some_obj)
n

Nick DeCraene

09/28/2022, 9:09 PM
awesome, thanks for the help!
m

Mason Menges

09/28/2022, 9:11 PM
No Problem 😄