2011-04-02 00:45:26 -07:00
|
|
|
from multiprocessing.managers import BaseManager
|
|
|
|
import Queue
|
|
|
|
|
2011-05-15 17:01:45 -07:00
|
|
|
tasks_q = Queue.Queue()
|
|
|
|
results_q = Queue.Queue()
|
2011-05-08 12:36:06 -07:00
|
|
|
minions_q = Queue.Queue()
|
2011-05-15 17:01:45 -07:00
|
|
|
master_q = Queue.Queue()
|
2011-04-02 00:45:26 -07:00
|
|
|
|
|
|
|
class QueueManager(BaseManager):
|
2011-05-15 17:01:45 -07:00
|
|
|
"""
|
|
|
|
One QueueManager to rule all network Queues
|
|
|
|
"""
|
2011-04-02 00:45:26 -07:00
|
|
|
pass
|
|
|
|
|
2011-05-15 17:01:45 -07:00
|
|
|
QueueManager.register('get_tasks_q' , callable=lambda:tasks_q )
|
|
|
|
QueueManager.register('get_results_q', callable=lambda:results_q )
|
|
|
|
QueueManager.register('get_minions_q', callable=lambda:minions_q )
|
|
|
|
QueueManager.register('get_master_q' , callable=lambda:master_q )
|
2011-04-02 00:45:26 -07:00
|
|
|
|
2011-05-15 17:01:45 -07:00
|
|
|
def get_qs(qm):
|
2011-04-02 00:45:26 -07:00
|
|
|
"""
|
2011-05-15 17:01:45 -07:00
|
|
|
pass in a QueueManager, and this function returns all relevant
|
|
|
|
queues attached to that QueueManager.
|
2011-04-02 00:45:26 -07:00
|
|
|
"""
|
2011-05-15 17:01:45 -07:00
|
|
|
return (qm.get_tasks_q(),
|
|
|
|
qm.get_results_q(),
|
|
|
|
qm.get_master_q(),
|
|
|
|
qm.get_minions_q())
|