def run(self): while True: for task in self.tasklist: if task["status"] == 0: task["status"] = 1 cfg = task.get("cfg") if 'passive' in cfg.get("task_type"): pa = asset.PassiveAsset(task) pa.run() elif 'suricata' in cfg.get("task_type"): su = instrusion.IdsInstrusion(task) su.run() flow_log.info('task running ' + str(task)) time.sleep(6)
def init_scheduler(): flow_log.info("init_scheduler start ...") scheduler.start() flow_log.info(id(scheduler)) print id(scheduler)
def get_scheduler(): flow_log.info(id(scheduler)) return scheduler
def createtask(self, cfg): taskid = str(uuid.uuid4()) task = {"taskid": taskid, "cfg": cfg, "status": 0} self.tasklist.append(task) flow_log.info('createtask running ' + str(task)) return taskid
for task in self.tasklist: if task["status"] == 0: task["status"] = 1 cfg = task.get("cfg") if 'passive' in cfg.get("task_type"): pa = asset.PassiveAsset(task) pa.run() elif 'suricata' in cfg.get("task_type"): su = instrusion.IdsInstrusion(task) su.run() flow_log.info('task running ' + str(task)) time.sleep(6) scheduler = Scheduler() flow_log.info(id(scheduler)) # print scheduler def get_scheduler(): flow_log.info(id(scheduler)) return scheduler def init_scheduler(): flow_log.info("init_scheduler start ...") scheduler.start() flow_log.info(id(scheduler)) print id(scheduler)