refactor node state to fully put the agent in charge (#90)

This commit is contained in:
bmc-msft
2020-10-03 02:43:04 -04:00
committed by GitHub
parent a088e72299
commit e308a4ae1e
12 changed files with 326 additions and 198 deletions

View File

@ -108,7 +108,6 @@ class Task(BASE_TASK, ORMMixin):
self.save()
def stopping(self) -> None:
# TODO: we need to tell every node currently working on this task to stop
# TODO: we need to 'unschedule' this task from the existing pools
self.state = TaskState.stopping
@ -154,6 +153,11 @@ class Task(BASE_TASK, ORMMixin):
task = tasks[0]
return task
def mark_stopping(self) -> None:
if self.state not in [TaskState.stopped, TaskState.stopping]:
self.state = TaskState.stopping
self.save()
def mark_failed(self, error: Error) -> None:
if self.state in [TaskState.stopped, TaskState.stopping]:
logging.debug(