summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.com>2017-07-12 16:44:11 +0100
committerTristan Maat <tristan.maat@codethink.com>2017-07-12 16:51:07 +0100
commit998a599f7ce36557181aae8f6e6b93b18c43f38c (patch)
tree70c251328be1fec3d0f014ed0f5fc8dd578b601b
parentdd15b1ba494c4725fd452b6723ff799d1708830c (diff)
downloadbuildstream-inconsistent_trace.tar.gz
widget.py: Fix stacktrace on early pipeline failureinconsistent_trace
This happened when no queues were setup and app.print_summary was called.
-rw-r--r--buildstream/_frontend/widget.py51
1 files changed, 26 insertions, 25 deletions
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index cd4cbdcbb..2a6099043 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -467,31 +467,32 @@ class LogLine(Widget):
processed_maxlen = 1
skipped_maxlen = 1
failed_maxlen = 1
- for queue in scheduler.queues:
- processed_maxlen = max(len(str(len(queue.processed_elements))), processed_maxlen)
- skipped_maxlen = max(len(str(len(queue.skipped_elements))), skipped_maxlen)
- failed_maxlen = max(len(str(len(queue.failed_elements))), failed_maxlen)
-
- for queue in scheduler.queues:
- processed = str(len(queue.processed_elements))
- skipped = str(len(queue.skipped_elements))
- failed = str(len(queue.failed_elements))
-
- processed_align = ' ' * (processed_maxlen - len(processed))
- skipped_align = ' ' * (skipped_maxlen - len(skipped))
- failed_align = ' ' * (failed_maxlen - len(failed))
-
- status_text = self.content_profile.fmt("processed ") + \
- self.success_profile.fmt(processed) + \
- self.format_profile.fmt(', ') + processed_align
-
- status_text += self.content_profile.fmt("skipped ") + \
- self.content_profile.fmt(skipped) + \
- self.format_profile.fmt(', ') + skipped_align
-
- status_text += self.content_profile.fmt("failed ") + \
- self.err_profile.fmt(failed) + ' ' + failed_align
- values["{} Queue".format(queue.action_name)] = status_text
+ if scheduler.queues is not None:
+ for queue in scheduler.queues:
+ processed_maxlen = max(len(str(len(queue.processed_elements))), processed_maxlen)
+ skipped_maxlen = max(len(str(len(queue.skipped_elements))), skipped_maxlen)
+ failed_maxlen = max(len(str(len(queue.failed_elements))), failed_maxlen)
+
+ for queue in scheduler.queues:
+ processed = str(len(queue.processed_elements))
+ skipped = str(len(queue.skipped_elements))
+ failed = str(len(queue.failed_elements))
+
+ processed_align = ' ' * (processed_maxlen - len(processed))
+ skipped_align = ' ' * (skipped_maxlen - len(skipped))
+ failed_align = ' ' * (failed_maxlen - len(failed))
+
+ status_text = (self.content_profile.fmt("processed ") +
+ self.success_profile.fmt(processed) +
+ self.format_profile.fmt(', ') + processed_align)
+
+ status_text += (self.content_profile.fmt("skipped ") +
+ self.content_profile.fmt(skipped) +
+ self.format_profile.fmt(', ') + skipped_align)
+
+ status_text += (self.content_profile.fmt("failed ") +
+ self.err_profile.fmt(failed) + ' ' + failed_align)
+ values["{} Queue".format(queue.action_name)] = status_text
text += self.format_values(values, style_value=False)