Reading multiprocessing.Pool doc I understood that map_async
and apply_async
are two versions of map
and appy
that are supposed to be faster, but that do not guarantee that the inputs are processed in the same order as they are provided.
However, I do not understand if, when calling multiprocessing.pool.AsyncResult.get()
are the results "reordered" to match the input order, or are they returned in the order they were processed?
Yes, return-order will be the same as input-order. The only difference is that the async-methods do not block the MainThread
in the parent and you will have to .get()
the result explicitly. .map()
and .map_async()
both call the same low-level method ._map_async()
under the hood.
Note that order of processing and return-order are two different things. Processing order is not guaranteed and influenced by chunking.
For .apply_async()
you will get the result for which specific AsyncResult
-object you are calling .get()
upon.