I'm trying to figure out how to write a program in python that uses the multiprocessing queue.
I have multiple servers and one of them will provide the queue remotely with this:
from multiprocessing.managers import BaseManager
import Queue
import daemonme
queue = Queue.Queue()
class QueueManager(BaseManager):
pass
daemonme.createDaemon()
QueueManager.register('get_job', callable=lambda:queue)
m = QueueManager(address=('', 50000), authkey='')
s = m.get_server()
s.serve_forever()
Now I want to use my dual Xeon, quad core server to process jobs off of this remote queue. The jobs are totally independent of one another. So if I have 8 cores, I'd like to start 7 processes that pick a job off the queue, process it, then go back for the next one. Each of the 7 processes will do this, but I can't quite get my head wrapped around the structure of this program.
Can anyone provide me some educated ideas about the basic structure of this?
Thank you in advance.