only record failures generated prior to stopping (#83)

This commit is contained in:
bmc-msft
2020-10-02 01:31:51 -04:00
committed by GitHub
parent a529f073a8
commit a196716e12
4 changed files with 29 additions and 16 deletions

View File

@ -154,6 +154,17 @@ class Task(BASE_TASK, ORMMixin):
task = tasks[0]
return task
def mark_failed(self, error: Error) -> None:
if self.state in [TaskState.stopped, TaskState.stopping]:
logging.debug(
"ignoring post-task stop failures for %s:%s", self.job_id, self.task_id
)
return
self.error = error
self.state = TaskState.stopping
self.save()
def get_pool(self) -> Optional[Pool]:
if self.config.pool:
pool = Pool.get_by_name(self.config.pool.pool_name)