{
"$type": "site.standard.document",
"canonicalUrl": "https://rednafi.com/python/tqdm-with-multiprocessing/",
"description": "Integrate tqdm progress bars with multiprocessing.imap_unordered for visual feedback on parallel task execution across worker processes.",
"path": "/python/tqdm-with-multiprocessing/",
"publishedAt": "2021-11-18T00:00:00.000Z",
"site": "at://did:plc:fgtm2c26vfcj74rfmeggbyqj/site.standard.publication/3mnl6f7ob462z",
"tags": [
"Python",
"TIL",
"Concurrency"
],
"textContent": "Making tqdm play nice with multiprocessing requires some additional work. It's not always\nobvious and I don't want to add another third-party dependency just for this purpose.\n\nThe following example attempts to make tqdm work with multiprocessing.imap_unordered.\nHowever, this should also work with similar mapping methods like - multiprocessing.map,\nmultiprocessing.imap, multiprocessing.starmap, etc.\n\nThis will print:\n\nFurther reading\n\n- [Using tqdm with multiprocessing]\n\n\n\n\n[using tqdm with multiprocessing]:\n https://stackoverflow.com/questions/58560686/using-tqdm-with-multiprocessing",
"title": "Running tqdm with Python multiprocessing"
}