Skip to main content

TQDM for an async Queue

· 8 min read
Tony Hallam
Application Consultant @ EPCC

After working through the Real Python tutorial for async functions I was curious about whether I could monitor the status of the async Queue used in one of the examples.

The example works by creating a number of producer coroutines and consumer coroutines that systematically add and remove 'jobs' from the shared queue. You can play with the number of producers and consumers to adjust the speed at which these jobs are produced and consumed which affects the size and status of the queue. You can get a feeling for it intrinsically by watching the standard output but I wondered if you could use TQDM.