From: Tony Mack Date: Fri, 22 Jul 2011 18:46:37 +0000 (-0400) Subject: use xmlrpc to access plcapi until out why PLC.Shell.Shell doesn't close db connection... X-Git-Tag: sfa-1.0-28~7^2~5 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=b0597e697f7915fc007958354d75e5c6146d78da;p=sfa.git use xmlrpc to access plcapi until out why PLC.Shell.Shell doesn't close db connection properly --- diff --git a/sfa/plc/api.py b/sfa/plc/api.py index 28e27483..8d0e806d 100644 --- a/sfa/plc/api.py +++ b/sfa/plc/api.py @@ -111,16 +111,20 @@ class SfaAPI(BaseAPI): self.plauth = {'Username': self.config.SFA_PLC_USER, 'AuthMethod': 'password', 'AuthString': self.config.SFA_PLC_PASSWORD} - try: - sys.path.append(os.path.dirname(os.path.realpath("/usr/bin/plcsh"))) - self.plshell_type = 'direct' - import PLC.Shell - shell = PLC.Shell.Shell(globals = globals()) - except: - self.plshell_type = 'xmlrpc' - url = self.config.SFA_PLC_URL - shell = xmlrpclib.Server(url, verbose = 0, allow_none = True) + + # The native shell (PLC.Shell.Shell) is more efficient than xmlrpc, + # but it leaves idle db connections open. use xmlrpc until we can figure + # out why PLC.Shell.Shell doesn't close db connection properly + #try: + # sys.path.append(os.path.dirname(os.path.realpath("/usr/bin/plcsh"))) + # self.plshell_type = 'direct' + # import PLC.Shell + # shell = PLC.Shell.Shell(globals = globals()) + #except: + self.plshell_type = 'xmlrpc' + url = self.config.SFA_PLC_URL + shell = xmlrpclib.Server(url, verbose = 0, allow_none = True) return shell def getCredential(self):