[Multiprocessing-sig] Shared network Queue in separate thread/process

Algirdas Brazas [Agilitus] algirdas at agilitus.lt
Tue Feb 28 14:13:16 CET 2012

Dear Sirs,

Earlier I had:

import Queue
from processing.managers import BaseManager, CreatorMethod
class QueueManager(BaseManager):
     sms_que = CreatorMethod(callable=lambda:myQueue, typeid='my_que')
m = QueueManager(address=('', 50000), authkey='none')

In 2.7, with rewrite to multiprocessing and .register I get 
"pickle.PicklingError: Can't pickle <function <lambda> at 
0x00000000028BF358>: it's not found as __parents_main__.<lambda>".
The code is:

from multiprocessing.managers import BaseManager, Queue
class QueueManager(BaseManager):
QueueManager.register('my_que', callable=lambda:myQueue)
m = QueueManager(address=('', 50000), authkey='none')

I can get it to work only with m.get_server().serve_forever(), but that 
is not what I need - I need the server in separate thread/process, to be 
able to use that Queue later. The same Queue is used by clients on the 

O to put the question otherwise - does anyone have recipe for shared 
network queues in 2.7?

Sincerely Yours

Algirdas Brazas

More information about the Multiprocessing-sig mailing list