Manager
This lesson introduces the manager as an entity that enables seamless sharing of data and objects amongst processes.
We'll cover the following...
Manager
Python provides a way to share data between processes that may be running on different machines. The previous examples we saw of inter-process communication were restricted to a single machine. Using the Manager
class we can share objects between processes running on the same machine or different machines.
Managers provide additional synchronization tools, such as a list or a dictionary, that can be shared between processes.
Proxy Pattern
The manager employs the proxy pattern to enable sharing of objects across different processes. The literal definition of proxy is the authority to represent someone else. In a proxy pattern setup, a proxy is responsible for representing another object called the subject (or referent in python) in front of clients. The real subject is shielded from interacting directly with the clients.
Base Manager
We’ll start with a simple example. Imagine, we want to share a string object between two processes. The object we intend to share gets created on the machine where the manager is running. A process running on a completely different machine will be able to access the same string object. Note that the runnable script shared here is restricted to a ...