by the way, splitbrain is an attempt to simplify distributed testing. see http://tomerfiliba.com/blog/Splitbrain/
it's not ready yet, though. it will take some time for it to mature. ----------------------------------------------------------------- *Tomer Filiba* tomerfiliba.com <http://www.facebook.com/tomerfiliba> <http://il.linkedin.com/in/tomerfiliba> On Sun, Sep 2, 2012 at 10:38 PM, Tomer Filiba <[email protected]> wrote: > then don't use the server's logger. this logger is only meant for > debugging/diagnostic purposes. if you want to log to a certain logger, just > create it on the client and pass it on to the server. for instance: > > === client === > import logging > logging.basicConfig(file="/tmp/foo.log") > mylogger = logging.getLogger("my oh my") > > conn.root.do_something(1, 2, 3, logger = mylogger) > > === server === > class MyService(rpyc.Service): > def exposed_do_something(self, a, b, c, logger): > logger.info("foo bar") > return a*b*c > > > ----------------------------------------------------------------- > > *Tomer Filiba* > tomerfiliba.com <http://www.facebook.com/tomerfiliba> > <http://il.linkedin.com/in/tomerfiliba> > > > > On Sun, Sep 2, 2012 at 7:48 PM, ben <[email protected]> wrote: > >> Hi Tomer, >> >> Thanks for the quick reply. >> >> As for number 1 - that explains why i was having trouble with passing >> classes backwards and forwards, thanks for the clarification. >> >> As for number 2 - i am writing an automated testing environment (ie, >> diagnostic testing) where some of the work will be done on the tester's >> machine (where the log instance will be created and where the log file will >> be stored) but i am hoping for the majority of the work to be done on the >> server machines (using RPyC to call methods on the server and pass classes >> and paramaters backwards and forwards). In the previous automation >> environment, everything was done via rpc calls from the tester's machine >> with our log being the main point of reference to determine success and >> failure as well as identifying errors in the source code. So, it is not >> simply to log exceptions. Ideally i would like to be able to pass the >> initial logging instance created on the tester's machine to each of the >> servers at the time the client's connection is made and get all logging >> from all servers in one centralized location at the conclusion of each test. >> >> is that even possible with RPyC? >> >> either way, to access the logger on the server(assuming i understood >> correctly from your response), i pass the logging instance as part of the >> config_dict at connection from the client to the server. On the server >> side, i do not have to set logger equal to anything and i will be able to >> access it via self.._config["logger"]. >> >> thanks again for your help >> >> ben >> >> >> On Sunday, September 2, 2012 2:53:58 PM UTC+3, Tomer Filiba wrote: >> >>> 1) it depends on you. the client and server's services are decoupled; >>> you can connect a VoidService client to a MyService server, which only >>> means the server won't be able to invoke functions on the client. on the >>> other hand, if you pass an object from the client to the server, the server >>> will be able to use it. what will it be able to use - depends on the >>> config. by default, only `exposed_` attributes and "safe" magic methods are >>> allowed, but you can change it via the configuration. >>> >>> 2) if you're using the classic rpyc (SlaveService), you can use >>> conn.root.getconn()<http://rpyc.sourceforge.net/api/core_service.html#rpyc.core.service.SlaveService.exposed_getconn>, >>> which returns the other party's connection. from this connection, you can >>> dig up ._config["logger"] to get hold of the logger instance. if you're not >>> using classic mode, you can implement an exposed method, say >>> exposed_get_logger, to do the trick. anyway, why do you need to get the >>> other party's logger? loggers are normally configured once and then used by >>> the server to log exceptions - it's for diagnostic purposes, not everyday >>> use. >>> >>> ------------------------------**------------------------------**----- >>> >>> *Tomer Filiba* >>> tomerfiliba.com <http://www.facebook.com/tomerfiliba> >>> <http://il.linkedin.com/in/tomerfiliba> >>> >>> >>> >>> On Sun, Sep 2, 2012 at 2:15 PM, ben <[email protected]> wrote: >>> >>>> I have a class that inherits from *rpyc.Service* (lets call it >>>> MyService) and i initiate a server via the command >>>> *rpyc.utils.server.ThreadServer(MyServer, >>>> port)*. >>>> >>>> I start the server and then connect to it from the client using the >>>> command: rpyc.connect(server_ip, port). >>>> >>>> I now have 2 questions: >>>> 1) if i add/change default params in the config_dict, do i need to add >>>> them on both the client and server end? >>>> 2) if i add a logger instance at the client end via the key 'logger', >>>> how do i access it at the server end? do i have to add something to the >>>> "on_connect" method of MyService? >>>> >>>> thx >>>> >>> >>> >
