I have a process which moves lots of data into a database. I use multiprocessing for this.
It runs nice and quickly, but even when it's finished (all the rows are moved), it doesn't seem to end.
I've added join as I thought it means that the process won't terminate until all other processes are complete
Is there something I have missed here? why doesn't it end?
p=mp.Pool(cpu_count())
p.map(do_process, result)
p.close()
p.join()
multiprocessingtends to swallow exceptions without reporting them. Try wrapping the body ofdo_processin atry/exceptblock and printing any exceptions.