mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
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
This commit is contained in:
@@ -162,6 +162,7 @@ def handle_work_error(self, task_id, subtasks=None):
|
|||||||
print('Executing error task id %s, subtasks: %s' %
|
print('Executing error task id %s, subtasks: %s' %
|
||||||
(str(self.request.id), str(subtasks)))
|
(str(self.request.id), str(subtasks)))
|
||||||
first_task = None
|
first_task = None
|
||||||
|
first_task_id = None
|
||||||
first_task_type = ''
|
first_task_type = ''
|
||||||
first_task_name = ''
|
first_task_name = ''
|
||||||
if subtasks is not None:
|
if subtasks is not None:
|
||||||
@@ -184,13 +185,14 @@ def handle_work_error(self, task_id, subtasks=None):
|
|||||||
break
|
break
|
||||||
if first_task is None:
|
if first_task is None:
|
||||||
first_task = instance
|
first_task = instance
|
||||||
|
first_task_id = instance.id
|
||||||
first_task_type = each_task['type']
|
first_task_type = each_task['type']
|
||||||
first_task_name = instance_name
|
first_task_name = instance_name
|
||||||
if instance.celery_task_id != task_id:
|
if instance.celery_task_id != task_id:
|
||||||
instance.status = 'failed'
|
instance.status = 'failed'
|
||||||
instance.failed = True
|
instance.failed = True
|
||||||
instance.job_explanation = "Previous Task Failed: %s for %s with celery task id: %s" % \
|
instance.job_explanation = 'Previous Task Failed: {"task_type": "%s", "task_name": "%s", "task_id": "%s"}' % \
|
||||||
(first_task_type, first_task_name, task_id)
|
(first_task_type, first_task_name, first_task_id)
|
||||||
instance.save()
|
instance.save()
|
||||||
instance.socketio_emit_status("failed")
|
instance.socketio_emit_status("failed")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user