swansonk14 / p_tqdm

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

Parallel mapping on Generators #19

Open BenBE opened 4 years ago

BenBE commented 4 years ago

When trying to p_map on an iterator/generator p_tqdm fails when checking the length while setting up tqdm.

Steps to reproduce:

def id(x):
    return x

a = t_imap(id, [1,2,3,4])
b = p_imap(id, a)
for c in b:
    b.write(c)

Expected result: Prints the numbers 1,2,3,4; each on its own line.

Actual result: Crashes inside p_tqdm before setting up tqdm.

Debugging: Both p_tqdm._parallel and p_tqdm._sequential are affected.