mirror of
https://github.com/ansible/awx.git
synced 2026-07-11 08:18:07 -02:30
add job_description to failed workflow node
* When workflow job fails because a workflow job node doesn't have a related unified_job_template note that with an error on the workflow job's job_description * When a workflow job fails because a failure path isn't defined, note that on the workflow job job_description
This commit is contained in:
@@ -129,15 +129,15 @@ class WorkflowDAG(SimpleDAG):
|
||||
obj = node['node_object']
|
||||
|
||||
if obj.unified_job_template is None:
|
||||
return True
|
||||
return True, "Workflow job node {} related unified job template missing".format(obj.id)
|
||||
if obj.job and obj.job.status in ['failed', 'canceled', 'error']:
|
||||
failed_nodes.append(node)
|
||||
for node in failed_nodes:
|
||||
obj = node['node_object']
|
||||
if (len(self.get_dependencies(obj, 'failure_nodes')) +
|
||||
len(self.get_dependencies(obj, 'always_nodes'))) == 0:
|
||||
return True
|
||||
return False
|
||||
return True, "Workflow job node {} has a status of '{}' without an error handler path".format(obj.id, obj.job.status)
|
||||
return False, None
|
||||
|
||||
r'''
|
||||
Determine if all nodes have been decided on being marked do_not_run.
|
||||
|
||||
@@ -178,14 +178,18 @@ class TaskManager():
|
||||
is_done = dag.is_workflow_done()
|
||||
if not is_done:
|
||||
continue
|
||||
has_failed = dag.has_workflow_failed()
|
||||
has_failed, reason = dag.has_workflow_failed()
|
||||
logger.info('Marking %s as %s.', workflow_job.log_format, 'failed' if has_failed else 'successful')
|
||||
result.append(workflow_job.id)
|
||||
new_status = 'failed' if has_failed else 'successful'
|
||||
logger.debug(six.text_type("Transitioning {} to {} status.").format(workflow_job.log_format, new_status))
|
||||
update_fields = ['status', 'start_args']
|
||||
workflow_job.status = new_status
|
||||
if reason:
|
||||
workflow_job.job_explanation = reason
|
||||
update_fields.append('job_explanation')
|
||||
workflow_job.start_args = '' # blank field to remove encrypted passwords
|
||||
workflow_job.save(update_fields=['status', 'start_args'])
|
||||
workflow_job.save(update_fields=update_fields)
|
||||
status_changed = True
|
||||
if status_changed:
|
||||
workflow_job.websocket_emit_status(workflow_job.status)
|
||||
|
||||
Reference in New Issue
Block a user