Exemple #1
0
    def __init__(self, outputQueue, config, sleep=300):
        ThreadManager.__init__(self, 'DatabaseManager', outputQueue)
        self.sleep = sleep

        if 'TEMP_DATABASE' in config:
            self.temporDB = TempDatabase(outputQueue, config['TEMP_DATABASE'])
        if 'DATABASE' in config:
            self.remoteDB = RemoteDatabase(outputQueue, config['DATABASE'])
        self.print('Inited.', logging.INFO)
Exemple #2
0
    def __init__(self, inputStream, outputQueue, argv=[], config=Config):
        ThreadManager.__init__(self, 'OutputStream', outputQueue)

        if not self.loadConfig(config) or self.isExit():
            self.stopped.set()
            return
        self.loadArgv(argv)
        self.initLogging()
        self.inputStream = inputStream
        self.print('Inited.', logging.INFO)
Exemple #3
0
    def __init__(self, outputQueue, argv=[], sleep=300, config=Config):
        ThreadManager.__init__(self, 'StatusManager', outputQueue)
        self.__sleep = sleep
        self.status = {}

        if not self.loadConfig(config=config) or self.isExit():
            self.stopped.set()
            return
        self.loadArgv(argv)
        self.print('Inited.', logging.INFO)
 def __init__(self, manager, outputQueue, json):
     try:
         ThreadManager.__init__(self, 'Schedule/%s' % json['name'], outputQueue)
         self.manager = manager
         self.name = 'Schedule/%s' % json['name']
         self.target = json['target']
         self.type = Type(json['type'])
         self.beforeScript = json['beforeScript']
         self.script = json['script']
         self.nextSchedule = self.manager.getScheduleByName(json['nextSchedule'])
         self.sleep = 0
         self.lastRun = 0
         self.print('Inited.', logging.INFO)
     except KeyError as keyErr:
         self.print('Init schedule failed: KeyError with missing %s' % keyErr, logging.WARNING)
     except:
         traceback.print_exc()
Exemple #5
0
    def __init__(self,
                 name,
                 subscribeList,
                 outputQueue,
                 sleep=0,
                 config=Config):
        ThreadManager.__init__(self, '%s' % name, outputQueue)
        self.sleep = sleep

        if not self.loadConfig(config) or self.isExit():
            self.stopped.set()
            return
        self.rcon = redis.StrictRedis(host=self.address[0],
                                      port=self.address[1],
                                      password=self.password)
        self.ps = self.rcon.pubsub()
        self.ps.subscribe(subscribeList)
        self.print('Subscribing: %s' % str(subscribeList), logging.DEBUG)
        self.print('Inited', logging.INFO)
Exemple #6
0
 def test_isExit(self):
     m = ThreadManager('NAME', Queue())
     assert m.stopped.isSet() == False
     m.exit()
     assert m.stopped.isSet() == True
Exemple #7
0
 def test_start(self):
     m = ThreadManager('NAME', Queue())
Exemple #8
0
 def __init__(self, outputQueue, redis):
     ThreadManager.__init__(self, 'InputStream', outputQueue)
     self.outputQueue = outputQueue
     self.redis = redis
     self.print('Inited.', logging.INFO)