PyDocs

Nav

Concurrent Execution

BaseManager

  • BaseManager(address=None, authkey=None, serializer='pickle', ctx=None, *, shutdown_timeout=1.0)
Base class for managers
Changed in 3.3, 3.11
  • 3.3: Manager objects support the context management protocol – see Context Manager Types. __enter__() starts the server process (if it has not already started) and then returns the manager object. __exit__() calls shutdown(). In previous versions __enter__() did not start the manager’s server process if it was not already started.
  • 3.11: Added the shutdown_timeout parameter.
Members of BaseManager

a

address
The address used by the manager.

c

connect
Connect manager object to the server process

g

get_server
Return server object with serve_forever() method and address attribute

r

register
Register a typeid with the manager type

s

shutdown
Stop the process used by the manager.
start
Spawn a server process for this manager object
1 Example
>>> from multiprocessing.managers import BaseManager
>>> from queue import Queue
>>> queue = Queue()
>>> class QueueManager(BaseManager): pass
>>> QueueManager.register('get_queue', callable=lambda:queue)
>>> m = QueueManager(address=('', 50000), authkey=b'abracadabra')
>>> s = m.get_server()
>>> s.serve_forever()
from the Python docs
See Also
No see-alsos for multiprocessing.managers/BaseManager
0 Notes
No notes for BaseManager