How can I handle multiprocessing.Pool() error in initialization?
In short, I use
pool = multiprocessing.Pool(os.cpu_count(), initializer=init)
def init():
# stop everything if that fails with exception
# init..
Related question How to handle initializer error in multiprocessing.Pool?
But it does not show how to exit the main process cleanly.
Is it possible to get each Process instance fromthe pool, and run a function in each of them?
Note this is not the same as pool.map, because I don't know in which process my function will run.