Skip to content

Instantly share code, notes, and snippets.

Last active Oct 12, 2018
What would you like to do?
Tqdm + pool.imap_unordered
from tqdm import tqdm
from multiprocessing import Pool
def myfn(x):
return x ** 2
with Pool() as pool:
args = list(range(1_000_000))
work = pool.imap_unordered(myfn, args, chunksize=100)
results = []
for out in tqdm(work, total=len(args)):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment