Handle multiple Tasks to a single Server

33 views
Skip to first unread message

Norbert Forgacs

unread,
Nov 7, 2016, 2:38:21 AM11/7/16
to rpyc
Hello guys, I am new to RPYC and I have the following problem and I don't know how to implement:

I have a server:

class MyService(rpyc.Service):
    def exposed_DoSomethingThatTakesTime(self):
          ... code that takes time to execute...
          ...
          ...
          return 1   # return value so the client will know that the service didn't finish

And I have the same client, running on multiple computers:

proxy = rpyc.connect('TMD4701G', 18862, config={'allow_public_attrs': True})
if proxy.root.DoSomethingThatTakesTime == 1:
      print(Service finished running for this computer)


Now my problem is, and what I wan't to achieve is that the if a Client already called the exposed Service, and the Service is running, the second Client which also calls the Service, should wait for the first one to finish --> Something like a task handling for the services exposed in the Server:


example:

Client 1 calls DoSomethingThatTakesTime()                                    Server executes for Client1
Client 2 calls DoSomethingThatTakesTime()                                    Waits for Server to finish executing to Client1
Client 3 calls DoSomethingThatTakesTime()                                    Waits for Server to finish executing to Client1 and Client2

Reply all
Reply to author
Forward
0 new messages