Created
November 10, 2022 19:05
-
-
Save fauxneticien/473810ffb3ede77506d1d21dae5457ef to your computer and use it in GitHub Desktop.
MWE for tqdm multiprocessing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Pool | |
import tqdm | |
import time | |
def _foo(my_number): | |
square = my_number * my_number | |
time.sleep(1) | |
return square | |
if __name__ == '__main__': | |
with Pool(2) as p: | |
r = list(tqdm.tqdm(p.imap(_foo, range(30)), total=30)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment