Christian Juhl11/11/2022, 12:30 PM
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!
from prefect import task, flow, get_run_logger @task def square_number(number): return number ** 2 @flow def my_flow(): squared_numbers =  for i in range(5): result = square_number.submit(i) squared_numbers.append(result.result()) return squared_numbers if __name__ == '__main__': output = my_flow() print(output)
Christopher Boyd11/11/2022, 4:49 PM
Christian Juhl11/12/2022, 11:03 AM