From ae3f5c220e5e88b73c31075cacc95272a83dcd18 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 12 Oct 2015 13:24:03 -0400 Subject: [PATCH] Change celery task id in dependent job failure msg We'll now display a little json that should help the UI in rendering a link to the dependent job in the job detail screen --- awx/main/tasks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index a34d6e3973..faee1116bd 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -162,6 +162,7 @@ def handle_work_error(self, task_id, subtasks=None): print('Executing error task id %s, subtasks: %s' % (str(self.request.id), str(subtasks))) first_task = None + first_task_id = None first_task_type = '' first_task_name = '' if subtasks is not None: @@ -184,13 +185,14 @@ def handle_work_error(self, task_id, subtasks=None): break if first_task is None: first_task = instance + first_task_id = instance.id first_task_type = each_task['type'] first_task_name = instance_name if instance.celery_task_id != task_id: instance.status = 'failed' instance.failed = True - instance.job_explanation = "Previous Task Failed: %s for %s with celery task id: %s" % \ - (first_task_type, first_task_name, task_id) + instance.job_explanation = 'Previous Task Failed: {"task_type": "%s", "task_name": "%s", "task_id": "%s"}' % \ + (first_task_type, first_task_name, first_task_id) instance.save() instance.socketio_emit_status("failed")