Fixed #657, better cancel task support

pull/688/head
Piero Toffanin 2019-06-26 12:52:58 -04:00
rodzic 9702e5e5b7
commit b86847bb54
4 zmienionych plików z 5 dodań i 16 usunięć

Wyświetl plik

@ -445,7 +445,6 @@ class Task(models.Model):
nonlocal last_update
time_has_elapsed = time.time() - last_update >= 2
if time_has_elapsed:
testWatch.manual_log_call("Task.process.callback")
self.check_if_canceled()
@ -483,13 +482,11 @@ class Task(models.Model):
self.status = status_codes.CANCELED
self.pending_action = None
self.save()
elif self.import_url:
# Imported tasks need no special action
else:
# Tasks with no processing node or UUID need no special action
self.status = status_codes.CANCELED
self.pending_action = None
self.save()
else:
raise NodeServerError("Cannot cancel a task that has no processing node or UUID")
elif self.pending_action == pending_actions.RESTART:
logger.info("Restarting {}".format(self))

@ -1 +1 @@
Subproject commit 2a5d73ae2dfc89fc69f24095baebe31f0f0ac340
Subproject commit 48cf7f01b2ab96b6fdbdcb81d4ddc5828ae66c0e

Wyświetl plik

@ -116,15 +116,7 @@ class ProcessingNode(models.Model):
opts = self.options_list_to_dict(options)
if not settings.TESTING:
task = api_client.create_task(images, opts, name, progress_callback)
else:
# The create_task function uses multi-threaded parallel uploads
# but Django tests cannot cope with DB updates from different threads
# (and progress_callback often updates the DB). So during testing
# we use the fallback function equivalent which is single-threaded
task = api_client.create_task_fallback(images, opts, name, progress_callback)
task = api_client.create_task(images, opts, name, progress_callback)
return task.uuid
def get_task_info(self, uuid, with_output=None):

Wyświetl plik

@ -37,7 +37,7 @@ pip-autoremove==0.9.0
psycopg2==2.7.4
psycopg2-binary==2.7.4
PyJWT==1.5.3
pyodm==1.5.1
pyodm==1.5.3
pyparsing==2.1.10
pytz==2018.3
rcssmin==1.0.6