mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
Cancel jobs if they were deleted in the database
This commit is contained in:
parent
e096ad18cb
commit
7b880c6552
@ -1180,7 +1180,11 @@ class BaseTask(object):
|
||||
'''
|
||||
Ansible runner callback to tell the job when/if it is canceled
|
||||
'''
|
||||
self.instance = self.update_model(self.instance.pk)
|
||||
unified_job_id = self.instance.pk
|
||||
self.instance = self.update_model(unified_job_id)
|
||||
if not self.instance:
|
||||
logger.error('unified job {} was deleted while running, canceling'.format(unified_job_id))
|
||||
return True
|
||||
if self.instance.cancel_flag or self.instance.status == 'canceled':
|
||||
cancel_wait = (now() - self.instance.modified).seconds if self.instance.modified else 0
|
||||
if cancel_wait > 5:
|
||||
|
Loading…
Reference in New Issue
Block a user