swansonk14 / p_tqdm

Parallel processing with progress bars
MIT License
457 stars 44 forks source link

Nested p_map causing AssertionError in thread pool #20

Open BenBE opened 4 years ago

BenBE commented 4 years ago

Trying to nest p_map (e.g. to implement generating a square matrix) causes Python to barf out with a failed assertion.

Steps to reproduce:

from functools import partial

l = [1, 2, 3]

def add(a, b):
    return a + b

def gen_mat(x):
    nonlocal l
    return p_map(partial(add, x), l)

mat = p_map(gen_mat, l)
print(mat)

Expected Result:

[[2,3,4],[3,4,5],[4,5,6]]

Actual Result:

AssertionError: daemonic processes are not allowed to have children
Irazall commented 4 years ago

same here