0

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.

DPM
  • 845
  • 7
  • 33
  • Does this answer your question? [Python Process Pool non-daemonic?](https://stackoverflow.com/questions/6974695/python-process-pool-non-daemonic) – Kroshka Kartoshka Oct 30 '20 at 00:16
  • Yes and no. It seems to be able to create a pool inside a pool but I don't really understand how it is done – DPM Oct 30 '20 at 00:57

0 Answers0