Ejemplo n.º 1
0
    def __init__(self, config):
        """
        BaseClass which can set up the concurrent task using cherrypy thread.
        WARNING: This assumes each task doesn't share the object.
        (It can be share only read operation is performed)
        If the object shared by multple task and read/write operation is performed.
        Lock is not provided for these object

        :arg config  WMCore.Configuration object. which need to contain in duration attr.
        TODO: add validation for config.duration
        """
        self.logger = getTimeRotatingLogger(config._internal_name,
                                            config.log_file)
        self.logger.info(
            "Setting CherryPy periodic task with the following config:\n%s",
            config)
        self.setConcurrentTasks(config)
        self.setUpLogDB(config)

        for task in self.concurrentTasks:
            PeriodicWorker(task['func'],
                           config,
                           task['duration'],
                           logger=self.logger,
                           logDB=self.logDB)
Ejemplo n.º 2
0
    def __init__(self, config):

        """
        BaseClass which can set up the concurrent task using cherrypy thread.
        WARNING: This assumes each task doesn't share the object. 
        (It can be share only read operation is performed)
        If the object shared by multple task and read/write operation is performed. 
        Lock is not provided for these object
    
        :arg config  WMCore.Configuration object. which need to contain in duration attr.
        TODO: add validation for config.duration
        """
        self.logger = getTimeRotatingLogger(config._internal_name, config.log_file)
        self.setConcurrentTasks(config)
        for task in self.concurrentTasks:
            PeriodicWorker(task["func"], config, task["duration"], logger=self.logger)