diff options
author | Jürg Billeter <j@bitron.ch> | 2020-04-15 11:08:48 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-04-20 14:27:16 +0200 |
commit | 908f1433fe93b202012f7bf124c68e5ac6b9fbb3 (patch) | |
tree | 83653287febfa8f2656b7a63e4d38c7c0129cfd7 /src/buildstream | |
parent | ed2e2028830714702f1c6c3559b51b2601655806 (diff) | |
download | buildstream-908f1433fe93b202012f7bf124c68e5ac6b9fbb3.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.
Diffstat (limited to 'src/buildstream')
-rw-r--r-- | src/buildstream/_artifact.py | 19 |
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() # |