class MAPELoop(object): monitor = None analyzer = None planner = None optimize_plan = 0 def __init__(self): self.monitor = Monitor() self.analyzer = Analyer() self.planner = Planner() self.optimize_plan = db_session.query(Account_Policies).first() def run(self): while True: total_tasks = self.monitor.total_tasks() task_breakdown = self.monitor.tasks() plan_count = self.monitor.get_plan_count() analysis = self.analyzer.analyze(plan_count, total_tasks, task_breakdown) if type(analysis) is list: self.planner.plan_and_execute(analysis) sleep(2)
def __init__(self): self.monitor = Monitor() self.analyzer = Analyer() self.planner = Planner() self.optimize_plan = db_session.query(Account_Policies).first()