I use to run long independent jobs with multiprocessing.Pool.map
import multiprocessing
pool = multiprocessing.Pool(multiprocessing.cpu_count())
input_var = [1,2,3]
ris = pool.map(long_function,input_var)
pool.close()
pool.join()
This works well but if for example I get an error in long_function(2) I will lose all the information that I have obtained with long_function(1) and long_function(3).
is there a way to avoid this?
The best would be to obtain an output like ris=[long_function(1), ERROR, long_function(3)]
Is there anyway to do that?