I am writing a a script in Python 3.7 that launches several parallel tasks using multiprocessing.Process (a task per core). To track down the progress for each process, I used the library tqdm which implements a progress bar. My code looks like the following:
with tqdm(total=iterator_size) as progress_bar:
for row in tqdm(batch):
process_batch(batch)
progress_bar.update(1)
The progress bar is indeed updated accordingly, but since multiple processes run the code above, each one overwrites the bar on the console, as the screenshot below illustrates.
Upon finishing, the console correctly displays the completed progress bars:
My goal is to have the progress bars updating without overwriting each other. Is there a way I can achieve this?
A possible solution would be to only display the progress bar on the process that's gonna take the longest (I know before hand which one is), but the best case scenario would be to have one for each process updating according to the second image.
All the solutions online address multiprocess.Pool, but I don't plan to change my architecture, since I can get the most out of multiprocess.Process.

