diff options
Diffstat (limited to 'src/buildstream/_frontend/widget.py')
-rw-r--r-- | src/buildstream/_frontend/widget.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/buildstream/_frontend/widget.py b/src/buildstream/_frontend/widget.py index 955680f9b..85fb00768 100644 --- a/src/buildstream/_frontend/widget.py +++ b/src/buildstream/_frontend/widget.py @@ -827,3 +827,38 @@ class LogLine(Widget): text += '\n' return text + + # show_state_of_artifacts() + # + # Show the cached status of artifacts + # + # Example output: + # + # "cached foo.bst" <- If cached locally + # "failed foo.bst" <- If cached locally as a failure + # "available foo.bst" <- If available to download from a remote + # "not cached foo.bst" <- If not cached/available remotely. + # + # Note that artifact names may also be displayed here. + # + # Args: + # targets (list [Element]): Elements (or ArtifactElements) we wish to show the + # cached status of + # + def show_state_of_artifacts(self, targets): + report = '' + p = Profile() + for element in targets: + line = '%{state: >12} %{name}' + line = p.fmt_subst(line, 'name', element.name, fg='yellow') + + if element._cached_success(): + line = p.fmt_subst(line, 'state', "cached", fg='magenta') + elif element._cached(): + line = p.fmt_subst(line, 'state', "failed", fg='red') + else: + line = p.fmt_subst(line, 'state', "not cached", fg='bright_red') + + report += line + '\n' + + return report |