So the thing is I want to get the return value from the starmap_async
. However if I use the .get()
to get the list of the result, it is little slow and same as starmap
. How do I change the following sample code?
full_res = []
def return_result(result):
full_res.append(result)
with mp.get_context("spawn").Pool(5,maxtasksperchild=1000) as pool:
result=pool.starmap_async(fun, [(args)],callback=return_result)
pool.close()
pool.join()
By the way, I do not need the order.