summaryrefslogtreecommitdiff
path: root/buildstream/_artifact.py
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-03-25 07:45:23 +0100
committerJürg Billeter <j@bitron.ch>2019-03-25 10:24:41 +0100
commit0ae9ef747bc4488e46ea129bff6d779d68de5655 (patch)
treefcaa275b6ed94d49491176f9214e6bf68e672363 /buildstream/_artifact.py
parent3e586591349bef3b269414debd80ca44d6d2d6fa (diff)
downloadbuildstream-0ae9ef747bc4488e46ea129bff6d779d68de5655.tar.gz
_artifact.py: Add cached_logs() method
Diffstat (limited to 'buildstream/_artifact.py')
-rw-r--r--buildstream/_artifact.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/buildstream/_artifact.py b/buildstream/_artifact.py
index e812aa1a7..9cb6f5744 100644
--- a/buildstream/_artifact.py
+++ b/buildstream/_artifact.py
@@ -476,6 +476,26 @@ class Artifact():
return True
+ # cached_logs()
+ #
+ # Check if the artifact is cached with log files.
+ #
+ # Args:
+ # key (str): The artifact key
+ #
+ # Returns:
+ # (bool): True if artifact is cached with logs, False if
+ # element not cached or missing logs.
+ #
+ def cached_logs(self, key=None):
+ if not self._element._cached():
+ return False
+
+ vdir, _ = self._get_directory(key)
+
+ logsdigest = vdir._get_child_digest('logs')
+ return self._artifacts.cas.contains_directory(logsdigest, with_files=True)
+
# _get_directory():
#
# Get a virtual directory for the artifact contents