mirror of
https://github.com/ansible/awx.git
synced 2026-04-11 04:59:22 -02:30
don't reap jobs that aren't running
this is a simple sanity check, but it should help us avoid shooting
ourselves in the foot in complicated scenarios, such as:
1. A dispatcher worker is running a job, and it's killed with `kill -9`
2. The dispatcher attempts to reap jobs with a matching celery_task_id
3. The associated sync project update has the *same* celery_task_id
(an implementation detail of how we implemented that), and it ends
up getting reaped _even though_ it's already finished and has
status=successful
This commit is contained in:
@@ -11,6 +11,9 @@ logger = logging.getLogger('awx.main.dispatch')
|
|||||||
|
|
||||||
|
|
||||||
def reap_job(j, status):
|
def reap_job(j, status):
|
||||||
|
if UnifiedJob.objects.get(id=j.id).status not in ('running', 'waiting'):
|
||||||
|
# just in case, don't reap jobs that aren't running
|
||||||
|
return
|
||||||
j.status = status
|
j.status = status
|
||||||
j.start_args = '' # blank field to remove encrypted passwords
|
j.start_args = '' # blank field to remove encrypted passwords
|
||||||
j.job_explanation += ' '.join((
|
j.job_explanation += ' '.join((
|
||||||
|
|||||||
Reference in New Issue
Block a user