smbinterp/interp/cluster/__init__.py

22 lines
621 B
Python
Raw Normal View History

from multiprocessing.managers import BaseManager
import Queue
tasks_q = Queue.Queue()
results_q = Queue.Queue()
minions_q = Queue.Queue()
master_q = Queue.Queue()
class QueueManager(BaseManager):
pass
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 )
def get_qs(m):
"""
returns all relevant queues
"""
return (m.get_tasks_q(), m.get_results_q(), m.get_master_q(), m.get_minions_q())