def run(self): outputs = {} for handle in self.handles: if '(类型)' not in handle.keys(): raise RuntimeError('not find (类型)') handle_type: str = handle['(类型)'] if handle_type == '(输出)': outputer = GioOutputer(self.projects, self.dashboards, handle, outputs) outputer.run() elif handle_type == '(邮件)': emailer = Emailer(self.mailbox, handle, outputs) emailer.run()
def run(self): if len(self.handles) is 0: raise RuntimeError('未找到任务处理') for handle in self.handles: # print(handle) if len(handle) is 0: raise RuntimeError('未找到操作片段') results = {} for segment in handle: key = list(segment.keys())[0] value = list(segment.values())[0] if key == '(SELECT)': selecter = Selecter(self.databases, results, value) selecter.run() print(results) elif key == '(JOIN)': joiner = Joiner(results, value) joiner.run() print(results) elif key == '(UNION)': unioner = Unioner(results, value) unioner.run() print(results) elif key == '(ADD)': adder = Adder(results, value) minuser.run() print(results) elif key == '(MINUS)': minuser = Minuser(results, value) minuser.run() print(results) elif key == '(GROUP)': grouper = Grouper(results, value) grouper.run() print(results) elif key == '(输出)': outputer = Outputer(results, value) outputer.run() print(results) elif key == '(邮件)': emailer = Emailer(self.email, value[0], results) emailer.run()