Add force argument to Task.mark_failed()

This commit is contained in:
allegroai 2021-04-12 22:56:33 +03:00
parent c4e9a7d387
commit 50d620cc9a

View File

@ -555,11 +555,14 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
return self.send(tasks.CompletedRequest(self.id, status_reason='completed'), ignore_errors=ignore_errors) return self.send(tasks.CompletedRequest(self.id, status_reason='completed'), ignore_errors=ignore_errors)
return self.send(tasks.StoppedRequest(self.id, status_reason='completed'), ignore_errors=ignore_errors) return self.send(tasks.StoppedRequest(self.id, status_reason='completed'), ignore_errors=ignore_errors)
def mark_failed(self, ignore_errors=True, status_reason=None, status_message=None): def mark_failed(self, ignore_errors=True, status_reason=None, status_message=None, force=False):
# type: (bool, Optional[str], Optional[str]) -> () # type: (bool, Optional[str], Optional[str], bool) -> ()
""" The signal that this Task stopped. """ """ The signal that this Task stopped. """
return self.send(tasks.FailedRequest(self.id, status_reason=status_reason, status_message=status_message), return self.send(
ignore_errors=ignore_errors) tasks.FailedRequest(
task=self.id, status_reason=status_reason, status_message=status_message, force=force),
ignore_errors=ignore_errors,
)
def publish(self, ignore_errors=True): def publish(self, ignore_errors=True):
# type: (bool) -> () # type: (bool) -> ()