Loading buildstream/_artifactcache/artifactcache.py +3 −0 Original line number Diff line number Diff line Loading @@ -333,6 +333,9 @@ class ArtifactCache(): # key (str): The cache key to use # progress (callable): The progress callback, if any # # Returns: # (bool): True if pull was successful, False if artifact was not available # def pull(self, element, key, *, progress=None): raise ImplError("Cache '{kind}' does not implement pull()" .format(kind=type(self).__name__)) Loading buildstream/_artifactcache/ostreecache.py +6 −4 Original line number Diff line number Diff line Loading @@ -171,9 +171,14 @@ class OSTreeCache(ArtifactCache): try: # fetch the artifact from highest priority remote using the specified cache key remote = artifact_map.lookup_first(ref) remotes = artifact_map.lookup(ref) if not remotes: return False remote = remotes[0] remote_name = self._ensure_remote(self.repo, remote.pull_url) _ostree.fetch(self.repo, remote=remote_name, ref=ref, progress=progress) return True except OSTreeError as e: raise ArtifactError("Failed to pull artifact for element {}: {}" .format(element.name, e)) from e Loading Loading @@ -429,8 +434,5 @@ class _OSTreeArtifactMap(): def lookup(self, ref): return self._ref_to_remotes.get(ref, []) def lookup_first(self, ref): return self._ref_to_remotes.get(ref, [])[0] def contains(self, ref): return ref in self._ref_to_remotes buildstream/element.py +2 −2 Original line number Diff line number Diff line Loading @@ -1569,12 +1569,12 @@ class Element(Plugin): if self.__remotely_strong_cached: key = self.__strict_cache_key self.__artifacts.pull(self, key, progress=progress) assert self.__artifacts.pull(self, key, progress=progress) # update weak ref by pointing it to this newly fetched artifact self.__artifacts.link_key(self, key, weak_key) elif not context.get_strict() and self.__remotely_cached: self.__artifacts.pull(self, weak_key, progress=progress) assert self.__artifacts.pull(self, weak_key, progress=progress) # extract strong cache key from this newly fetched artifact self._update_state() Loading Loading
buildstream/_artifactcache/artifactcache.py +3 −0 Original line number Diff line number Diff line Loading @@ -333,6 +333,9 @@ class ArtifactCache(): # key (str): The cache key to use # progress (callable): The progress callback, if any # # Returns: # (bool): True if pull was successful, False if artifact was not available # def pull(self, element, key, *, progress=None): raise ImplError("Cache '{kind}' does not implement pull()" .format(kind=type(self).__name__)) Loading
buildstream/_artifactcache/ostreecache.py +6 −4 Original line number Diff line number Diff line Loading @@ -171,9 +171,14 @@ class OSTreeCache(ArtifactCache): try: # fetch the artifact from highest priority remote using the specified cache key remote = artifact_map.lookup_first(ref) remotes = artifact_map.lookup(ref) if not remotes: return False remote = remotes[0] remote_name = self._ensure_remote(self.repo, remote.pull_url) _ostree.fetch(self.repo, remote=remote_name, ref=ref, progress=progress) return True except OSTreeError as e: raise ArtifactError("Failed to pull artifact for element {}: {}" .format(element.name, e)) from e Loading Loading @@ -429,8 +434,5 @@ class _OSTreeArtifactMap(): def lookup(self, ref): return self._ref_to_remotes.get(ref, []) def lookup_first(self, ref): return self._ref_to_remotes.get(ref, [])[0] def contains(self, ref): return ref in self._ref_to_remotes
buildstream/element.py +2 −2 Original line number Diff line number Diff line Loading @@ -1569,12 +1569,12 @@ class Element(Plugin): if self.__remotely_strong_cached: key = self.__strict_cache_key self.__artifacts.pull(self, key, progress=progress) assert self.__artifacts.pull(self, key, progress=progress) # update weak ref by pointing it to this newly fetched artifact self.__artifacts.link_key(self, key, weak_key) elif not context.get_strict() and self.__remotely_cached: self.__artifacts.pull(self, weak_key, progress=progress) assert self.__artifacts.pull(self, weak_key, progress=progress) # extract strong cache key from this newly fetched artifact self._update_state() Loading