diff options
author | James Ennis <james.ennis@codethink.com> | 2019-01-18 12:54:34 +0000 |
---|---|---|
committer | James Ennis <james.ennis@codethink.com> | 2019-02-13 09:35:45 +0000 |
commit | 775ac472a3bb86fe048924d843fbfde69ff2b911 (patch) | |
tree | 4acebd8e3629a05cf6e970e13cd3859bf6a1abee /buildstream/_stream.py | |
parent | 77345317405c680064487817e7da622dc7bdd5ad (diff) | |
download | buildstream-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.py | 25 |
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 |