CORE
The server part - Core, which is responsible for the registration of modules and the interaction between them. Core runs as ThreadedServer. CoreService provides registration modules. When registering I keep a list of Connections, then to use them. Module calls at the core function that it should call another module. But to use the list of connections does not work, the performance goes into an infinite loop.
class CoreService(rpyc.Service):
__modules = {}
def exposed_register_module(self, module_name):
if module_name in self.__modules:
return False
self.__modules[module_name] = self._conn
return True
def exposed_execute_query_module(self, module_name, attribute_name, args):
# TTTTTTTTTTHHHHHHHHHIIIIIIIISSSSSSSSSSSSSS
if module_name in self.__modules:
self.__modules[module_name].root
# return None
Run test
When you run the test I get in into a loop which is interrupted by a combination of keys and get the following output:
^CTraceback (most recent call last): File "/home/kpv/perseus/control-lib/perseus_control_lib/module.py", line 67, in __getattr__ return self.__core_connector.root.execute_query_module(self.__proxy_module_name, name, args) File "/usr/local/lib/python2.7/dist-packages/rpyc/core/netref.py", line 196, in __call__ return syncreq(_self, consts.HANDLE_CALL, args, kwargs) File "/usr/local/lib/python2.7/dist-packages/rpyc/core/netref.py", line 71, in syncreq return conn.sync_request(handler, oid, *args) File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 438, in sync_request self.serve(0.1) File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 387, in serve data = self._recv(timeout, wait_for_lock = True) File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 344, in _recv if self._channel.poll(timeout): File "/usr/local/lib/python2.7/dist-packages/rpyc/core/channel.py", line 43, in poll return self.stream.poll(timeout) File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 41, in poll rl, _, _ = select([self], [], [], timeout) KeyboardInterrupt