Get multiprocessing.Queue to do priorities

uuid M8R-gqmgb4 at mailinator.com
Sat May 9 12:42:34 EDT 2009


Hello,
I was wondering whether there was a way to make multiprocessing.Queue 
behave in a priority queue-like fashion. Subclassing with heappush and 
heappop for put and get doesn't work the old way (multiprocessing.Queue 
seems to use different data structures than Queue.Queue?)

Could one create a heapq within the producer as a proxy, and then feed 
a proper queue from that? Does anyone have an idea on how to deal with 
the queue item flow control? (Since all of the sorting has to happen 
within the heapq, it should only pass items to the real Queue if it's 
empty?)

Thanks in advance!




More information about the Python-list mailing list