How can I collapse similar tasks [when using Task.map()] into a single node on the DAG in Prefect UI #17620
Replies: 1 comment 1 reply
-
hi @AmagicalFishy - while there is not existing UI functionality to group mapped tasks under a node (without a wrapping task/flow), there is one common way to get that outcome which is to wrap your mapped tasks in a task or flow so say you have this now @task
def foo(x): ...
@flow
def parent():
results = foo.map(range(10)).result()
print("doing other python stuff") you could instead do this @task
def foo(x): ...
@flow # this could also be a task if you want
def going_to_map(xs):
return foo.map(xs)
@flow
def parent():
results = going_to_map(range(10))
print("doing other python stuff") and in the resulting flow run, the mapped |
Beta Was this translation helpful? Give feedback.
-
I'm loving Prefect so far, but I've got a question:
I've got a flow that has a couple of tasks spun up w/

map
, and create many instances of these tasks. When viewing the DAG on the UI, I'd like for these tasks to all be collapsed into a single node.As it is now, it's a little unruly and difficult to read. I don't need to see every individual call.
Is there a way of achieving this?
Beta Was this translation helpful? Give feedback.
All reactions