def handle_run_stopped_triggered(workers_backend, event: "Event") -> None: # noqa: F821 run = manager.get_run(run_id=event.instance_id, run=event.instance) if run.is_managed and conf.get(SCHEDULER_ENABLED): workers_backend.send(CoreSchedulerCeleryTasks.RUNS_STOP, kwargs={"run_id": event.instance_id}) return manager.runs_stop(run_id=event.instance_id, run=event.instance)
def runs_stop(self, run_id, update_status=False, message=None): stopped = manager.runs_stop( run_id=run_id, run=None, update_status=update_status, message=message ) if not stopped and self.request.retries < 2: _logger.info("Trying again to delete job `%s` in run.", run_id) self.retry(countdown=Intervals.RUNS_SCHEDULER) return