From 31dbf38a35af48985f55d8b53f10e3d85d4ff3b4 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Mon, 24 Feb 2020 11:35:57 -0500 Subject: [PATCH] Prevent failing a successful project update if inventory update fails Scenario - job is launched and spawns inventory update and project update. If the inventory update fails, then it will fail the job and the project update. It will fail the project update even if that update already ran and was successful. This code change will not fail the project update if it has already ran successfully. In cases where other jobs depend on that project update (but not the failed inventory update), then we don't want those jobs to fail. --- awx/main/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index f96b5dc3b2..5f98684e3b 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -584,7 +584,7 @@ def handle_work_error(task_id, *args, **kwargs): first_instance = instance first_instance_type = each_task['type'] - if instance.celery_task_id != task_id and not instance.cancel_flag: + if instance.celery_task_id != task_id and not instance.cancel_flag and not instance.status == 'successful': instance.status = 'failed' instance.failed = True if not instance.job_explanation: @@ -1692,7 +1692,7 @@ class RunJob(BaseTask): if settings.MAX_FORKS > 0 and job.forks > settings.MAX_FORKS: logger.warning(f'Maximum number of forks ({settings.MAX_FORKS}) exceeded.') args.append('--forks=%d' % settings.MAX_FORKS) - else: + else: args.append('--forks=%d' % job.forks) if job.force_handlers: args.append('--force-handlers')