Hi guys, How do I store the result from submitted...
# prefect-community
Hi guys, How do I store the result from submitted tasks that are run concurrently?
Copy code
from prefect import task, flow, get_run_logger

def square_number(number):

    return number ** 2

def my_flow():

    squared_numbers = []

    for i in range(5):
        result = square_number.submit(i)

    return squared_numbers

if __name__ == '__main__':

    output = my_flow()
In this example, the next task is not submitted until the previous completes (they don't run concurrently), but if I move append(result.result()) outside the for loop, only the result from the last task is returned. Thanks!
If you are running things concurrently, I believe you would be looking for a map function which returns a list of results
Thanks @Christopher Boyd, exactly what I needed
Is it possible to combine map() with with_options() for tags?