Issue 3518: multiprocessing: BaseManager.from_address documented but doesn't exist (original) (raw)

Created on 2008-08-07 17:46 by mark.dickinson, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (7)
msg70844 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-08-07 17:46
The BaseManager.from_address method is documented at: http://docs.python.org/dev/library/multiprocessing.html#multiprocessing.ma nagers.BaseManager.from_address but it looks as though this method doesn't actually exist. In contrast, the BaseManager.connect method appears to be necessary for making remote connections, but is not documented.
msg75140 - (view) Author: Mart Sõmermaa (mrts) Date: 2008-10-23 11:17
The documentation should be amended as follows: Running the following commands creates a server for a single shared queue which remote clients can access: >>> from multiprocessing.managers import BaseManager >>> import Queue >>> queue = Queue.Queue() >>> class QueueManager(BaseManager): pass ... >>> QueueManager.register('getQueue', callable=lambda:queue) >>> m = QueueManager(address=('', 50000), authkey='abracadabra') >>> s = m.get_server() >>> s.serve_forever() One client can access the server as follows: >>> from multiprocessing.managers import BaseManager >>> class QueueManager(BaseManager): pass ... >>> QueueManager.register('getQueue') >>> m = QueueManager(address=('localhost', 50000), authkey='abracadabra') >>> m.connect() >>> q = m.getQueue() >>> q.put('hello') Another client can also use it: >>> from multiprocessing.managers import BaseManager >>> class QueueManager(BaseManager): pass ... >>> QueueManager.register('getQueue') >>> m = QueueManager(address=('localhost', 50000), authkey='abracadabra') >>> m.connect() >>> q = m.getQueue() >>> q.get()
msg75141 - (view) Author: Mart Sõmermaa (mrts) Date: 2008-10-23 11:55
Also, it would be helpful to elaborate a bit more on: major: * how to implement a queue that is shared both locally and remotely (i.e. n local processes access the queue as well as m remote processes) minor: * blocking (assumption: q.get() blocks on socket.recv()) * timeout (assumption: the socket does not time out, e.g. q.get() blocks endlessly on socket.recv())
msg75156 - (view) Author: Mart Sõmermaa (mrts) Date: 2008-10-24 09:52
I propose we add the following to that section as well. If you need to provide access to a queue from both local and remote processes, use `multiprocessing.Queue` in the server: >>> from multiprocessing import Process, Queue >>> from multiprocessing.managers import BaseManager >>> class Worker(Process): ... def __init__(self, q): ... self.q = q ... super(Worker, self).__init__() ... def run(self): ... self.q.put('local hello') ... >>> q = Queue() >>> w = Worker(q) >>> w.start() >>> class QueueManager(BaseManager): pass ... >>> QueueManager.register('getQueue', callable=lambda: q) >>> m = QueueManager(address=('', 50000), authkey='abracadabra') >>> s = m.get_server() >>> s.serve_forever() Use it in the client as shown above: >>> from multiprocessing.managers import BaseManager >>> class QueueManager(BaseManager): pass ... >>> QueueManager.register('getQueue') >>> m = QueueManager(address=('localhost', 50000), authkey='abracadabra') >>> m.connect() >>> q = m.getQueue() >>> q.get() 'local hello' >>> q.put('remote hello')
msg76546 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2008-11-28 18:48
Added the mp.managers shared queue example, fixed the docs in r67419 on trunk. merged to py3k and 2.6.1 maint
msg90359 - (view) Author: Casey McGinty (cmcginty) Date: 2009-07-09 22:39
I would like to open this ticket back up. Python 2.6.2 docs still reference unimplemented 'from_address' method. http://docs.python.org/library/multiprocessing.html#multiprocessing.managers.BaseManager.from_address BaseManager.__reduce__ method also calls unimplemented 'from_address' method. This looks like a bug since there is no docs or comments that indicate it is as an abstract method.
msg162628 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-06-11 16:57
New changeset c2910971eb86 by Richard Oudkerk in branch 'default': Issue #3518: Remove references to non-existent BaseManager.from_address() http://hg.python.org/cpython/rev/c2910971eb86
History
Date User Action Args
2022-04-11 14:56:37 admin set github: 47768
2014-06-29 10:41:48 berker.peksag link issue5862 superseder
2012-06-11 17:34:35 sbt set status: open -> closedstage: resolved
2012-06-11 16:57:52 python-dev set nosy: + python-devmessages: +
2012-06-10 17:29:36 r.david.murray set assignee: jnoller -> nosy: + sbtversions: + Python 2.7, Python 3.2, Python 3.3, - Python 2.6, Python 3.0
2010-08-27 14:05:30 asksol set nosy: + asksol
2009-07-09 22:45:25 jnoller set status: closed -> openresolution: fixed -> accepted
2009-07-09 22:39:58 cmcginty set nosy: + cmcgintymessages: +
2008-11-28 18:48:55 jnoller set status: open -> closedresolution: fixedmessages: +
2008-10-24 09:52:24 mrts set messages: +
2008-10-23 11:55:12 mrts set messages: +
2008-10-23 11:17:29 mrts set nosy: + mrtsmessages: +
2008-08-07 17:46:07 mark.dickinson create