Skip to Content
Modern Python Standard Library Cookbook
book

Modern Python Standard Library Cookbook

by Alessandro Molina
August 2018
Intermediate to advanced
366 pages
10h 14m
English
Packt Publishing
Content preview from Modern Python Standard Library Cookbook

There's more...

multiprocessing.Manager is not constrained to work with processes that originated from the same process.

It's possible to create a Manager that will listen on a network so that any process that is able to connect to it might be able to access its content:

>>> import multiprocessing.managers
>>> manager = multiprocessing.managers.SyncManager(
...     address=('localhost', 50000), 
...     authkey=b'secret'
... )
>>> print(manager.address)
('localhost', 50000)

Then, once the server is started:

>>> manager.get_server().serve_forever()

The other processes will be able to connect to it by creating a manager2 instance with the exact same arguments of the manager they want to connect to, and then explicitly connect:

>>> manager2 = multiprocessing.managers.SyncManager( ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Advanced Python Development: Using Powerful Language Features in Real-World Applications

Advanced Python Development: Using Powerful Language Features in Real-World Applications

Matthew Wilkes

Publisher Resources

ISBN: 9781788830829Supplemental Content