Get length of Queue in Python's multiprocessing library Get length of Queue in Python's multiprocessing library python-3.x python-3.x

Get length of Queue in Python's multiprocessing library


If the queue you are talking about is multiprocessing.Queue, try to use qsize() method for multiprocessing.Queue objects, but be careful:

qsize()

Return the approximate size of the queue. Because of multithreading/multiprocessing semantics, this number is not reliable.

Note that this may raise NotImplementedError on Unix platforms like Mac OS X where sem_getvalue() is not implemented.