summaryrefslogtreecommitdiff
path: root/buildstream/_stream.py
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.com>2019-01-18 12:54:34 +0000
committerJames Ennis <james.ennis@codethink.com>2019-02-13 09:35:45 +0000
commit775ac472a3bb86fe048924d843fbfde69ff2b911 (patch)
tree4acebd8e3629a05cf6e970e13cd3859bf6a1abee /buildstream/_stream.py
parent77345317405c680064487817e7da622dc7bdd5ad (diff)
downloadbuildstream-775ac472a3bb86fe048924d843fbfde69ff2b911.tar.gz
cli.py: Move artifact ref handling logic to stream
The loading of elements and the handling of artifacts does not belong in this module. Such logic should be invoked using the Stream API
Diffstat (limited to 'buildstream/_stream.py')
-rw-r--r--buildstream/_stream.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index 6fc5c45fb..6e97aeccd 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -495,6 +495,31 @@ class Stream():
raise StreamError("Error while staging dependencies into a sandbox"
": '{}'".format(e), detail=e.detail, reason=e.reason) from e
+ # artifact_log()
+ #
+ # Show the full log of an artifact
+ #
+ # Args:
+ # targets (str): Targets to view the logs of
+ #
+ # Returns:
+ # logsdir (list): A list of CasBasedDirectory objects containing artifact logs
+ #
+ def artifact_log(self, targets):
+ # Return list of Element and/or ArtifactElement objects
+ target_objects = self.load_selection(targets, selection=PipelineSelection.NONE, load_refs=True)
+
+ logsdirs = []
+ for obj in target_objects:
+ ref = obj.get_artifact_name()
+ if not obj._cached():
+ self._message(MessageType.WARN, "{} is not cached".format(ref))
+ continue
+
+ logsdirs.append(self._artifacts.get_artifact_logs(ref))
+
+ return logsdirs
+
# source_checkout()
#
# Checkout sources of the target element to the specified location