Esempio n. 1
0
 def delete_driver(self):
     if self.driver:
         self.driver.disconnect()    
         DriverManager._unregister_driver(self.driver) 
         yield self.driver.delete()
         self.driver=None         
         log.msg("Disconnected and removed driver", logLevel=logging.CRITICAL,system="Node")
     defer.returnValue(None)
Esempio n. 2
0
 def delete_driver(self):
     if self.driver:
         self.driver.disconnect()
         DriverManager._unregister_driver(self.driver)
         yield self.driver.delete()
         self.driver = None
         log.msg("Disconnected and removed driver",
                 logLevel=logging.CRITICAL,
                 system="Node")
     defer.returnValue(None)
Esempio n. 3
0
 def setup(self):
     self.driver=yield DriverManager.load(parentNode=self)
     
     env= (yield self.environment.get())
     self.signal_channel_prefix="environment_"+str(env.id)+".node_"+str(self.id)
     
     log.msg("Node with id",self.id, "setup successfully",system="Node", logLevel=logging.CRITICAL)
     self.elementsandVarsTest()
     defer.returnValue(None)
Esempio n. 4
0
 def render_GET(self, request):
     """
     Handler for GET requests of driver types
     """
     r=ResponseGenerator(request,status=200,contentType="application/pollapli.driverTypeList+json",resource="driverTypes",rootUri=self.rootUri)
     d=RequestParser(request,"driverTypes",self.valid_contentTypes,self.validGetParams).ValidateAndParseParams()      
     d.addCallbacks(callback=lambda params:DriverManager.get_driver_types(params),errback=r._build_response)
     d.addBoth(r._build_response)
     request._call=reactor.callLater(0,d.callback,None)
     return NOT_DONE_YET
Esempio n. 5
0
        def update():
            yield self.delete_driver()
            self.driver = yield DriverManager.create(parentNode=self, **kwargs)

            log.msg("Set driver of node",
                    self.id,
                    " with params ",
                    kwargs,
                    system="Node")
            defer.returnValue(None)
Esempio n. 6
0
    def setup(self):
        self.driver = yield DriverManager.load(parentNode=self)

        env = (yield self.environment.get())
        self.signal_channel_prefix = "environment_" + str(
            env.id) + ".node_" + str(self.id)

        log.msg("Node with id",
                self.id,
                "setup successfully",
                system="Node",
                logLevel=logging.CRITICAL)
        self.elementsandVarsTest()
        defer.returnValue(None)
Esempio n. 7
0
 def setup(self):
     """configure all systems """
     from twisted.enterprise import adbapi
     from twistar.registry import Registry
     envPath=os.path.join(EnvironmentManager.envPath,"home")
     dbPath=os.path.join(envPath,"home")+".db"
     Registry.DBPOOL = adbapi.ConnectionPool("sqlite3",database=dbPath,check_same_thread=False)
     """this is a required but very cheap hack: since twistard does not support multiple databases,
     we do not have a "master" database, which causes problems because of the dependencies, and initialization
     order of different elements, so for now, the "home" database is enforced"""
     
     yield UpdateManager.setup()
     yield DriverManager.setup()
     yield EnvironmentManager.setup()
     
     defer.returnValue(None)
Esempio n. 8
0
 def update():
     yield self.delete_driver()
     self.driver=yield DriverManager.create(parentNode=self,**kwargs)
     
     log.msg("Set driver of node",self.id," with params ", kwargs,system="Node")
     defer.returnValue(None)