mirror of
https://github.com/ansible/awx.git
synced 2026-03-23 03:45:01 -02:30
AC-620 Continue to update status while a task is running, so that long running tasks don't get inadvertently canceled.
This commit is contained in:
@@ -193,10 +193,11 @@ class BaseTask(Task):
|
|||||||
#task_stdout_handle.write(logfile.getvalue()[old_logfile_pos:logfile_pos])
|
#task_stdout_handle.write(logfile.getvalue()[old_logfile_pos:logfile_pos])
|
||||||
#task_stdout_handle.flush()
|
#task_stdout_handle.flush()
|
||||||
last_stdout_update = time.time()
|
last_stdout_update = time.time()
|
||||||
instance = self.get_model(instance.pk)
|
# Update instance status here (also updates modified timestamp, so
|
||||||
# Commit transaction needed when running unit tests. FIXME: Is it
|
# we have a way to know the task is still running, otherwise the
|
||||||
# needed or breaks anything for normal operation?
|
# post_run_hook below would cancel long-running tasks that are
|
||||||
transaction.commit()
|
# really still active).
|
||||||
|
instance = self.update_model(instance.pk, status='running')
|
||||||
if instance.cancel_flag:
|
if instance.cancel_flag:
|
||||||
child.close(True)
|
child.close(True)
|
||||||
canceled = True
|
canceled = True
|
||||||
|
|||||||
Reference in New Issue
Block a user