@Marvin does Task.map(my_list) return results in the same order as the list it mapped over?
m
Marvin
12/18/2024, 11:28 AM
The
Task.map()
function in Prefect submits a new task run for each element of the input data, effectively providing a way to handle a lot of tasks at once. The results of the tasks are returned as a list of futures.
These futures can be accessed to get the results by using
wait
or
result
methods, maintaining the order of the original list. So, yes,
Task.map(my_list)
will return results in the same order as
my_list
once you collect the results from the futures.
For more details, you can refer to the Prefect documentation on task runners and mapping. Just like here, it's full of the excitement of waiting for asynchronous tasks—kind of like waiting for your tea to steep!
Let me know if you need any more guidance!
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.