def on_start(self, service_act, parent_data): if service_act.execute(parent_data): if not service_act.need_schedule(): self._finish(service_act, parent_data) data_source = get_data_source(self._get_model()) data_source.set('service_act', service_act) data_source.set('parent_data', parent_data) self.set_default_scheduler(self.on_schedule) else: self.finish(status_code=2)
def on_schedule(self): data_source = get_data_source(self._get_model()) service_act = data_source.get('service_act') parent_data = data_source.get('parent_data') schedule_result = service_act.schedule(parent_data) if not schedule_result: self.finish(status_code=2) if service_act.is_schedule_done(): self._finish(service_act, parent_data) data_source.set('service_act', service_act) data_source.set('parent_data', parent_data)