summaryrefslogtreecommitdiff
path: root/buildstream
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-07-11 20:57:01 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-07-11 20:59:59 +0900
commitf8492135b51526920cf73ecd7f1c8b93aaa9d7f7 (patch)
tree1a30c992fa34f870ca2647b4ae2ad5195921e752 /buildstream
parentf0b4cc92d182e3bd9c94ab9d8a7923253284aede (diff)
downloadbuildstream-f8492135b51526920cf73ecd7f1c8b93aaa9d7f7.tar.gz
frontend: New status heading style, show success/skipped/failed elements
Now the (session/total) count is mentioned on the same line as the pipeline target and overall timer, the next line with queue counts now display success/skipped/failed element counts in them.
Diffstat (limited to 'buildstream')
-rw-r--r--buildstream/_frontend/main.py2
-rw-r--r--buildstream/_frontend/status.py85
2 files changed, 54 insertions, 33 deletions
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py
index e4ada3020..4a6f6d954 100644
--- a/buildstream/_frontend/main.py
+++ b/buildstream/_frontend/main.py
@@ -438,6 +438,7 @@ class App():
# UI Colors Profiles
self.content_profile = Profile(fg='yellow')
self.format_profile = Profile(fg='cyan', dim=True)
+ self.success_profile = Profile(fg='green')
self.error_profile = Profile(fg='red', dim=True)
self.detail_profile = Profile(dim=True)
@@ -545,6 +546,7 @@ class App():
# Create our status printer, only available in interactive
self.status = Status(self.content_profile, self.format_profile,
+ self.success_profile, self.error_profile,
self.pipeline, self.scheduler,
colors=self.colors)
diff --git a/buildstream/_frontend/status.py b/buildstream/_frontend/status.py
index 0372be373..5d421a688 100644
--- a/buildstream/_frontend/status.py
+++ b/buildstream/_frontend/status.py
@@ -42,10 +42,14 @@ from .widget import TimeCode
#
class Status():
- def __init__(self, content_profile, format_profile, pipeline, scheduler, colors=False):
+ def __init__(self, content_profile, format_profile,
+ success_profile, error_profile,
+ pipeline, scheduler, colors=False):
self.content_profile = content_profile
self.format_profile = format_profile
+ self.success_profile = success_profile
+ self.error_profile = error_profile
self.pipeline = pipeline
self.scheduler = scheduler
self.jobs = []
@@ -53,7 +57,9 @@ class Status():
self.term = Terminal()
self.spacing = 1
self.colors = colors
- self.header = StatusHeader(content_profile, format_profile, pipeline, scheduler)
+ self.header = StatusHeader(content_profile, format_profile,
+ success_profile, error_profile,
+ pipeline, scheduler)
self.term_width, _ = click.get_terminal_size()
self.alloc_lines = 0
@@ -233,61 +239,74 @@ class Status():
# The header widget renders total elapsed time and the main invocation information
class StatusHeader():
- def __init__(self, content_profile, format_profile, pipeline, scheduler):
+ def __init__(self, content_profile, format_profile,
+ success_profile, error_profile,
+ pipeline, scheduler):
+
self.content_profile = content_profile
self.format_profile = format_profile
+ self.success_profile = success_profile
+ self.error_profile = error_profile
self.pipeline = pipeline
self.scheduler = scheduler
self.time_code = TimeCode(content_profile, format_profile, brackets=False)
self.lines = 3
+ def render_queue(self, queue):
+ processed = str(len(queue.processed_elements))
+ skipped = str(len(queue.skipped_elements))
+ failed = str(len(queue.failed_elements))
+
+ size = 6 # Space for the formatting '[', ': ', '/', '/' and ']'
+ size += len(queue.complete_name)
+ size += len(processed) + len(skipped) + len(failed)
+ text = self.format_profile.fmt("[") + \
+ self.content_profile.fmt(queue.complete_name) + \
+ self.format_profile.fmt(": ") + \
+ self.success_profile.fmt(processed) + \
+ self.format_profile.fmt("/") + \
+ self.content_profile.fmt(skipped) + \
+ self.format_profile.fmt("/") + \
+ self.error_profile.fmt(failed) + \
+ self.format_profile.fmt("]")
+
+ return (text, size)
+
def render(self, line_length, elapsed):
line_length = max(line_length, 80)
size = 0
text = ''
+ session = str(self.pipeline.session_elements)
+ total = str(self.pipeline.total_elements)
+
# Format and calculate size for pipeline target and overall time code
+ size += len(total) + len(session) + 4 # Size for (N/N) with a leading space
size += 8 # Size of time code
size += len(self.pipeline.target.name) + 1
text += self.time_code.render_time(elapsed)
text += ' ' + self.content_profile.fmt(self.pipeline.target.name)
+ text += ' ' + self.format_profile.fmt('(') + \
+ self.content_profile.fmt(session) + \
+ self.format_profile.fmt('/') + \
+ self.content_profile.fmt(total) + \
+ self.format_profile.fmt(')')
line1 = self.centered(text, size, line_length, '=')
size = 0
text = ''
- # Number of elements to process in the session
- session = str(self.pipeline.session_elements)
- size += 10 + len(session)
- text += self.format_profile.fmt("[") + \
- self.content_profile.fmt("Session") + \
- self.format_profile.fmt(":") + \
- self.content_profile.fmt(session) + \
- self.format_profile.fmt("]")
-
- # Space
- size += 1
- text += ' '
-
- # Total elements of the pipeline
- total = str(self.pipeline.total_elements)
- size += 8 + len(total)
- text += self.format_profile.fmt("[") + \
- self.content_profile.fmt("Total") + \
- self.format_profile.fmt(":") + \
- self.content_profile.fmt(total) + \
- self.format_profile.fmt("]")
-
# Format and calculate size for each queue progress
for queue in self.scheduler.queues:
- processed = str(len(queue.processed_elements))
- size += len(processed) + len(queue.complete_name) + 4
- text += ' ' + \
- self.format_profile.fmt("[") + \
- self.content_profile.fmt(queue.complete_name) + \
- self.format_profile.fmt(":") + \
- self.content_profile.fmt(processed) + \
- self.format_profile.fmt("]")
+
+ # Add spacing
+ if self.scheduler.queues.index(queue) > 0:
+ size += 1
+ text += ' '
+
+ queue_text, queue_size = self.render_queue(queue)
+ size += queue_size
+ text += queue_text
line2 = self.centered(text, size, line_length, ' ')