Add Task.stopped reason arg

This commit is contained in:
allegroai 2021-10-16 23:15:00 +03:00
parent 371405cad9
commit 3b7fc2e0d2
2 changed files with 7 additions and 4 deletions

View File

@ -553,10 +553,13 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
""" The signal that this Task started. """
return self.send(tasks.StartedRequest(self.id, force=force), ignore_errors=ignore_errors)
def stopped(self, ignore_errors=True, force=False):
# type: (bool, bool) -> ()
def stopped(self, ignore_errors=True, force=False, status_reason=None):
# type: (bool, bool, Optional[str]) -> ()
""" The signal that this Task stopped. """
return self.send(tasks.StoppedRequest(self.id, force=force), ignore_errors=ignore_errors)
return self.send(
tasks.StoppedRequest(self.id, force=force, status_reason=status_reason),
ignore_errors=ignore_errors
)
def completed(self, ignore_errors=True):
# type: (bool) -> ()

View File

@ -2883,7 +2883,7 @@ class Task(_Task):
)
)
self.flush(wait_for_uploads=True)
self.stopped()
self.stopped(status_reason='USER ABORTED')
if self._dev_worker:
self._dev_worker.unregister()