August 2018
Intermediate to advanced
366 pages
10h 14m
English
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( ...