Closed carandraug closed 4 years ago
I forgot to mention, although it is mentioned on #124, that this would simplify what we've been calling composite devices.
I pushed ab194af36abe76c72d1 which adds the ability to pass a function that returns a dict. In addition of enabling what is mentioned before, it also provides a means of specifying the wanted Pyro URI. Something like this:
DEVICES = [
device(lambda kwargs: {'ThisDevice' : Camera()}, hostname, port),
]
Which would serve PYRO:ThisDevice@hostname:port
.
Currently, the configuration of a device server is as follow:
However, would be nice if instead one could pass a function that returns a device (or list of devices). Something like this:
Other than making it easier to construct some devices, the main reason is to enable have multiple devices on the same process. For most cases we want to have them in separate processes to avoid the GIL. However, in some cases we want instead to make it easier to pass data between devices. These are cases where we need to processing (typically an image) such as the Aurox. Actually, this has already been mentioned before (see comments and review of #124). We are currently abusing
ControllerDevice
to achieve this, but having the ability to pass a function that will construct the devices would solve that. We could then have something like: