def _run_task(self, ti: TaskInstance) -> bool: self.log.debug("Executing task: %s", ti) key = ti.key try: params = self.tasks_params.pop(ti.key, {}) ti._run_raw_task(job_id=ti.job_id, **params) # pylint: disable=protected-access self.change_state(key, State.SUCCESS) return True except Exception as e: # pylint: disable=broad-except self.change_state(key, State.FAILED) self.log.exception("Failed to execute task: %s.", str(e)) return False
def _run_task(self, ti: TaskInstance) -> bool: self.log.debug("Executing task: %s", ti) key = ti.key try: params = self.tasks_params.pop(ti.key, {}) ti._run_raw_task(job_id=ti.job_id, **params) self.change_state(key, State.SUCCESS) ti._run_finished_callback() return True except Exception as e: ti.set_state(State.FAILED) self.change_state(key, State.FAILED) ti._run_finished_callback(error=e) self.log.exception("Failed to execute task: %s.", str(e)) return False