Q:

apply_async order of results

If I understand correctly, apply_async returns immediately with an AsyncResult object. If I collect those objects in the following way, and use get() only after all workers have finished, is it safe to assume the values will be in the order the function was called?
objRes = [None] * len(aRange)
pool = Pool(processes=8)
for x in aRange:
    objRes[x] = pool.apply_async(f,(arg1, arg2, arg3,))
pool.close()
pool.join()

res = [None] * len(aRange)
for x in aRange:
    res[x] = objRes[x].get()

I started out trying to use pool.map() and pool.starmap() instead, but I have  two arrays as part of the arguments and couldn't figure out how exactly to pass them.

A:

The AsyncResult object returned by the apply_async function is associated to the tuple function-parameters you scheduled.
Hence, when you call AsyncResult.get you will get the results of that given job.
If you put the AsyncResult objects in a list with the same order as you scheduled the jobs then you will get the results in that order.
The map function internally works in a very similar fashion as in your example. If you want to pass more than a parameter to the scheduled function you need to group it with the rest of the arguments. It might be quite memory consuming if you have a lot of arguments.
arg_list = ((arg1, arg2, arg3) for _ in aRange)

pool.map(f, arg_list)

