This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
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 -> closed stage: resolved |
| 2012年06月11日 16:57:52 | python-dev | set | nosy:
+ python-dev messages: + msg162628 |
| 2012年06月10日 17:29:36 | r.david.murray | set | assignee: jnoller -> nosy: + sbt versions: + 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 -> open resolution: fixed -> accepted |
| 2009年07月09日 22:39:58 | cmcginty | set | nosy:
+ cmcginty messages: + msg90359 |
| 2008年11月28日 18:48:55 | jnoller | set | status: open -> closed resolution: fixed messages: + msg76546 |
| 2008年10月24日 09:52:24 | mrts | set | messages: + msg75156 |
| 2008年10月23日 11:55:12 | mrts | set | messages: + msg75141 |
| 2008年10月23日 11:17:29 | mrts | set | nosy:
+ mrts messages: + msg75140 |
| 2008年08月07日 17:46:07 | mark.dickinson | create | |