Minor organization clarity for workflow failure summary

This commit is contained in:
Alan Rominger
2021-01-05 10:33:35 -05:00
parent 9a16e9f787
commit d3c51ce75d

View File

@@ -17,9 +17,9 @@ class WorkflowJob(UnifiedJob):
"""Special implementation of this part of assert_status so that """Special implementation of this part of assert_status so that
workflow_job.assert_successful() will give a breakdown of failure workflow_job.assert_successful() will give a breakdown of failure
""" """
msg = '\nNode summary:'
node_list = self.related.workflow_nodes.get().results node_list = self.related.workflow_nodes.get().results
msg = '\nNode summary:'
for node in node_list: for node in node_list:
msg += '\n{}: {}'.format(node.id, node.summary_fields.get('job')) msg += '\n{}: {}'.format(node.id, node.summary_fields.get('job'))
for rel in ('failure_nodes', 'always_nodes', 'success_nodes'): for rel in ('failure_nodes', 'always_nodes', 'success_nodes'):
@@ -29,12 +29,14 @@ class WorkflowJob(UnifiedJob):
msg += '\n\nUnhandled individual job failures:\n' msg += '\n\nUnhandled individual job failures:\n'
for node in node_list: for node in node_list:
# nodes without always or failure paths consider failures unhandled
if node.job and not (node.failure_nodes or node.always_nodes): if node.job and not (node.failure_nodes or node.always_nodes):
job = node.related.job.get() job = node.related.job.get()
try: try:
job.assert_successful() job.assert_successful()
except Exception as e: except Exception as e:
msg += str(e) msg += str(e)
return msg return msg
@property @property