summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-04-15 11:08:48 +0200
committerJürg Billeter <j@bitron.ch>2020-04-19 07:07:32 +0200
commit4d1d6bd371017d6f7c987cbce608f98fdf4ee841 (patch)
treefd98740ba0a4ec87ec662e7ba053643d0e4261e1
parentc47aa499be261282d92b1b080bdf4c14f3f56d45 (diff)
downloadbuildstream-4d1d6bd371017d6f7c987cbce608f98fdf4ee841.tar.gz
_artifact.py: Don't consider an artifact cached if logs are missing
Artifact push and pull operations currently fail if logs are missing. We don't currently have a config option to control how long artifact logs should be kept in the cache. Until this changes, we should be conservative and consider logs to be an essential part of artifacts, keeping them from getting expired before the rest of the artifact.
-rw-r--r--src/buildstream/_artifact.py19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/buildstream/_artifact.py b/src/buildstream/_artifact.py
index 659facba4..7fe98dfaa 100644
--- a/src/buildstream/_artifact.py
+++ b/src/buildstream/_artifact.py
@@ -443,8 +443,10 @@ class Artifact:
self._cached = False
return False
- # Check whether public data is available
- if not self._cas.contains_file(artifact.public_data):
+ # Check whether public data and logs are available
+ logfile_digests = [logfile.digest for logfile in artifact.logs]
+ digests = [artifact.public_data] + logfile_digests
+ if not self._cas.contains_files(digests):
self._cached = False
return False
@@ -460,16 +462,9 @@ class Artifact:
# element not cached or missing logs.
#
def cached_logs(self):
- if not self._element._cached():
- return False
-
- artifact = self._get_proto()
-
- for logfile in artifact.logs:
- if not self._cas.contains_file(logfile.digest):
- return False
-
- return True
+ # Log files are currently considered an essential part of an artifact.
+ # If the artifact is cached, its log files are available as well.
+ return self._element._cached()
# reset_cached()
#