mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
Fix an issue where a well timed cancel could try to cancel a job right
after it has finished causing an error.
This commit is contained in:
parent
d46d9bb7f4
commit
472f086862
@ -393,11 +393,12 @@ class BaseTask(Task):
|
||||
# Refresh model instance from the database (to check cancel flag).
|
||||
instance = self.update_model(instance.pk)
|
||||
if instance.cancel_flag:
|
||||
os.kill(child.pid, signal.SIGINT)
|
||||
time.sleep(3)
|
||||
# The following line causes orphaned ansible processes
|
||||
# child.terminate(canceled)
|
||||
canceled = True
|
||||
try:
|
||||
os.kill(child.pid, signal.SIGINT)
|
||||
time.sleep(3)
|
||||
canceled = True
|
||||
except OSError:
|
||||
logger.warn("Attempted to cancel already finished job, ignoring")
|
||||
if idle_timeout and (time.time() - last_stdout_update) > idle_timeout:
|
||||
child.close(True)
|
||||
canceled = True
|
||||
|
Loading…
Reference in New Issue
Block a user