Fix Task.reset force not used

This commit is contained in:
allegroai 2021-12-10 21:21:32 +02:00
parent 9624f2c715
commit ab1c6ec0ca
2 changed files with 6 additions and 5 deletions

View File

@ -536,14 +536,15 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
res = self.send(tasks.GetByIdRequest(task=self.id))
return res.response.task
def reset(self, set_started_on_success=True):
# type: (bool) -> ()
def reset(self, set_started_on_success=True, force=False):
# type: (bool, bool) -> ()
"""
Reset the task. Task will be reloaded following a successful reset.
:param set_started_on_success: If True automatically set Task status to started after resetting it.
:param set_started_on_success: If True automatically set Task status to started after resetting it.
:param force: If not true, call fails if the task status is 'completed'
"""
self.send(tasks.ResetRequest(task=self.id))
self.send(tasks.ResetRequest(task=self.id, force=force))
if set_started_on_success:
self.started()
elif self._data:

View File

@ -1509,7 +1509,7 @@ class Task(_Task):
- ``False`` - Do not force (default)
"""
if not running_remotely() or not self.is_main_task() or force:
super(Task, self).reset(set_started_on_success=set_started_on_success)
super(Task, self).reset(set_started_on_success=set_started_on_success, force=force)
def close(self):
"""