Prefect v1 question: is there any way to use task ...
# prefect-community
d
Prefect v1 question: is there any way to use task looping with a function that creates tasks? I have a group of tasks that I'm using with
apply_map
and what I'd really like to do is have each of those be the body of a loop. It looks like you can only loop one single task though. Am I missing something? Thanks!
j
Hi @Daniel Komisar could you clarify what you mean by using tasks as the body of a loop? Did you mean like mapping the task creation function?
I'm not sure how your apply map is being set up, but perhaps you can loop through your different functions and then pass them in as params like
Copy code
with Flow("apply-map example") as flow:
    for f in [creation_task, creation_task2]:
        result = apply_map(f, range(4))