How to Neatly Display Parallel Output in Terminal?
When using modules like multiprocessing or threading for parallel processing, have you ever wondered how to print string messages from each process or thread effectively?
Most people would simply use print()
in the terminal. However, when the output is too long or too much, it might not be particularly useful. In such scenarios, it’s often best to write the outputs to a file so you can trace back any issues later.
Still, most of the time, we want to know the latest status of each executing unit, like which step it’s currently at. If these outputs continue to pile up in the terminal, it inevitably makes the terminal quite messy.
In this article, I will introduce a method to refresh and overlay outputs of parallel processing, so you can see the latest status of each unit while keeping the terminal clean and elegant!
Posted on Mar 13, 2024 in Python Programming - Intermediate Level by Amo Chen ‐ 3 min read