https://prefect.io logo
#prefect-server
Title
# prefect-server
l

Lana Dann

06/06/2022, 7:25 PM
is it possible to have a flow that has a dynamic number of tasks? for example: task 1: get a list of values for each value, kick off a task
k

Kevin Kho

06/06/2022, 7:26 PM
Kind of with task looping, but not a sequence of tasks
l

Lana Dann

06/06/2022, 7:28 PM
😮 very cool. i will look into it thank you
z

Zanie

06/06/2022, 9:53 PM
Also mapping would work for this simple case.
k

Kevin Kho

06/06/2022, 10:01 PM
^ as long as the sequential order does not matter
l

Lana Dann

06/08/2022, 5:43 PM
is it possible to do mapping with a task that takes in 2 arguments? e.g.
Copy code
tuples = [(1, 1), (2, 2), (3, 4)]
map_task = task(lambda x, y: x + y)

with Flow('Tuple Maps') as flow:
    map_task.map(tuples)
i tried this and am getting
Copy code
TypeError: missing a required argument: 'y'
ignore me lol. i realize i can just do something like:
Copy code
@task
def map_task(tup):
    x, y = tup
    return x + y

...
map_task.map(tuples)
k

Kevin Kho

06/08/2022, 6:00 PM
tuples
is of type
List[Tuple]
. Mapping needs
Tuple[List]
. Know what I mean?
7 Views