niedakh/pqdm

BrokenProcessPool returned

Closed this issue · 1 comments

  • Parallel TQDM version: 4.50.2
  • Python version: 3.8.5
  • Operating System: win10

Description

I run the example in Jupyter Notebook:

from pqdm.processes import pqdm
# If you want threads instead:
# from pqdm.threads import pqdm

args = [1, 2, 3, 4, 5]
# args = range(1,6) would also work

def square(a):
    return a*a

result = pqdm(args, square, n_jobs=2)

However, when I check the value of result, it shows:

[concurrent.futures.process.BrokenProcessPool('A process in the process pool was terminated abruptly while the future was running or pending.'),
 concurrent.futures.process.BrokenProcessPool('A process in the process pool was terminated abruptly while the future was running or pending.'),
 concurrent.futures.process.BrokenProcessPool('A process in the process pool was terminated abruptly while the future was running or pending.'),
 concurrent.futures.process.BrokenProcessPool('A process in the process pool was terminated abruptly while the future was running or pending.'),
 concurrent.futures.process.BrokenProcessPool('A process in the process pool was terminated abruptly while the future was running or pending.')]

I see the reason according to this question.

Running the following code in the terminal (not interpreter) works fine:

from pqdm.processes import pqdm
# If you want threads instead:
# from pqdm.threads import pqdm
def square(a):
    return a*a
def test():
    args = [1, 2, 3, 4, 5]
    # args = range(1,6) would also work
    result = pqdm(args, square, n_jobs=2)
    return result

if __name__ == '__main__':
    res = test()
    for s in res:
    	print(s)