Ok you are right that works.
Although, for me this only works in classic mode (by replacing rpyc.connect 
with rpyc.classic.connect)

Thanks

Hannes
 

> import rpyc
> conn1 = rpyc.connect("common-host")
> conn2 = conn1.modules["rpyc"].connect("end-host")
>
>
> -tomer
>
>
>
> -----------------------------------------------------------------
>     
> *Tomer Filiba* 
> tomerfiliba.com     <http://www.facebook.com/tomerfiliba>     
> <http://il.linkedin.com/in/tomerfiliba> 
>
>
> On Fri, Jul 25, 2014 at 3:26 PM, <[email protected] <javascript:>> 
> wrote:
>
>> Hello,
>>
>> I am fairly new to RPyC so I am probably missing something here.
>> I try to implement the following scenario:
>>
>> I have several JobClients, which should execute some jobs 
>> Then, I have a JobManager, which holds a list of jobs to execute.
>>
>> Problem: Both cannot connect directly to each other, due to firewalls.
>>
>> So, I have a third component, called dispatcher on a host which can be 
>> reached from everyone.
>> The idea is to have the manager service exposed over the dispatcher to 
>> the client, who asks for jobs.
>> In my implementation the Dispatcher saves the root object of the 
>> management service and exposes it for the clients.
>>
>> But, as soon as one client tries to called a function of the manager 
>> service, the client freezes.
>> The debugger shows that it hangs in stream.py line 48.
>>
>> A MWE might look like this:
>> dispatcher.py: (has to started first)
>>
>> import rpyc
>> class SimpleDispatcherService(rpyc.Service):
>>
>>     exposed_manager_root = None
>>
>>     def on_connect(self):
>>         pass
>>
>>     def on_disconnect(self):
>>         pass
>>
>>     def exposed_register_manager(self):
>>         SimpleDispatcherService.exposed_manager_root = self._conn.root
>>
>> if __name__ == "__main__":
>>     from rpyc.utils.server import ThreadedServer
>>     t = ThreadedServer(SimpleDispatcherService, port=18861,
>>                        protocol_config = {"allow_public_attrs" : True})
>>     t.start()
>>
>> manager.py (has to started second):
>> import time
>> import rpyc
>>
>>
>> class SimpleManagerService(rpyc.Service):
>>
>>     def on_connect(self):
>>         pass
>>
>>     def on_disconnect(self):
>>         pass
>>
>>     def exposed_get_my_jobs(self, hostname):
>>         return ["Test", ]
>>
>>
>> class SimpleManager:
>>
>>     def __init__(self):
>>         self.conn = None
>>
>>     def start(self):
>>         self.conn = rpyc.connect("localhost", 18861, service=
>> SimpleManagerService)
>>         self.conn.root.register_manager()
>>
>>     def run(self):
>>         while True:
>>             time.sleep(1)
>>
>>
>>
>> if __name__ == "__main__":
>>     myManager = SimpleManager()
>>     myManager.start()
>>     myManager.run()
>>
>> client.py (has to be started last:)
>> import rpyc
>> class SimpleClient:
>>     def __init__(self):
>>         pass
>>
>>     def run(self):
>>         conn = rpyc.connect("localhost", 18861)
>>         print("Connected fetching processes")
>>         new_processes = conn.root.manager_root.get_my_jobs("Test")
>>         print(new_processes)
>>
>> if __name__ == "__main__":
>>     myClient = SimpleClient()
>>     myClient.run()
>>
>> This prints "Connected fetching processes" but hangs afterwards.
>> My setup: python3.2 on Ubuntu precise 64 with virtualenv and rpyc 3.3 
>> installed via pip
>>
>> Any help appreciated
>>
>> Regards,
>> Hannes Riechmann
>>
>> -- 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "rpyc" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"rpyc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to