summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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