mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-13 10:38:08 +00:00
refactor node state to fully put the agent in charge (#90)
This commit is contained in:
@ -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(
|
||||
|
Reference in New Issue
Block a user