I am trying to create a pool
inside a pool
and I seem to get an error I cannot correct, even by searching the error. Here is the code:
import numpy as np
import multiprocessing as mp
cpus = mp.cpu_count() - 1
def f(x):
pool1 = mp.Pool(cpus)
lista = list(pool1.map(sleep, [60] * 1000))
pool1.close()
pool1.join()
return lista
pool2 = mp.Pool(cpus)
lista2 = pool2.map(f, range(1000))
pool2.close()
pool2.join()
Here is the error: AssertionError: daemonic processes are not allowed to have children
I don't know why I am getting this error since I properly close
and join
every pool
.