コード例 #1
0
ファイル: backpack.py プロジェクト: aquamatt/Peloton
    def initialise(self):
        # get class for persistence and initialise
        self.backEnd = \
            getClassFromString(self.config.storageBackend)(self.kernel, self.config)

        self.get = self.backEnd.get
        self.set = self.backEnd.set
        self.getmulti = self.backEnd.getmulti
        self.delete = self.backEnd.delete

        # create the callable
        self.iface = BackPackIO(self)
コード例 #2
0
ファイル: mapping.py プロジェクト: aquamatt/Peloton
    def launchService(self, serviceName, runconfig=None):
        """ Start the process of launching a service which will require
the following steps:
    
    1. Locate the profile, extract the psclimits and launch parameters
    3. Create a service launch sequencer with the profile and start it
 """
        self.logger.info("Mapping launch request for service %s" % serviceName)
        # 1. locate and load the profile
        pqcn = "%s.%s.%s" % (serviceName.lower(), serviceName.lower(), serviceName)
        cls = getClassFromString(pqcn, reload=True)
        self.__service = cls(serviceName, None, None)
        self.__service.loadConfig(self.kernel.settings.servicepath, runconfig)
        # 2. Start the sequencer
        ServiceLaunchSequencer(self.kernel, serviceName, self.__service.profile).start()
コード例 #3
0
ファイル: worker.py プロジェクト: aquamatt/Peloton
    def loadService(self, runtimeConfig = None):
        """ Loading a service happens as follows:
    - Load service class
    - Validate its signature cookie ???
    - Load configs: Here the configuration files are read and 
internals are organised. This is generally NOT overidden by the
service writer who instead provides the startup() method to do logical
business level initialisation.

Raises ServiceConfigurationError if the name is invalid.
        """        
        try:
            pqcn = "%s.%s.%s" % (self.name.lower(), self.name.lower(), self.name)
            cls = getClassFromString(pqcn)
            self.__service = cls(self.name, self.dispatcher, logging.getLogger(self.name))
            self.__service.initSupportServices()
            self.__service.loadConfig(self.servicepath, runtimeConfig)
        except Exception, ex:
            raise ServiceConfigurationError("Could not find class for service %s" % self.name, ex)
コード例 #4
0
ファイル: testUtils.py プロジェクト: aquamatt/Peloton
 def test_getClassFromString(self):
     c = 'peloton.kernel.PelotonKernel'
     cls = getClassFromString(c)
     from peloton.kernel import PelotonKernel as MatchClass
     self.assertEquals(cls, MatchClass)
     self.assertRaises(Exception, getClassFromString, 'peloton.kernel.Bogus')