diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-07-23 09:57:02 +0000 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-07-23 09:57:02 +0000 |
commit | 364706f3282b840d2ff3268ce83904277c8a63e8 (patch) | |
tree | a50215ce199d9716c94be46c289516efff85c9de | |
parent | fe0df616d21395ec2a2ebb70ef79cf5d2a3c9d21 (diff) | |
parent | 1d36df25de46979245a13f4a9149ca1eec30c4eb (diff) | |
download | buildstream-364706f3282b840d2ff3268ce83904277c8a63e8.tar.gz |
Merge branch 'Qinusty/275' into 'master'
Indicate where artifacts are going to and coming from in the log
Closes #275
See merge request BuildStream/buildstream!553
-rw-r--r-- | buildstream/_artifactcache/cascache.py | 7 | ||||
-rw-r--r-- | buildstream/element.py | 36 |
2 files changed, 25 insertions, 18 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py index 1e84c282f..a540c8c61 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -221,6 +221,8 @@ class CASCache(ArtifactCache): try: remote.init() + element.info("Pulling {} <- {}".format(element._get_brief_display_key(), remote.spec.url)) + request = buildstream_pb2.GetReferenceRequest() request.key = ref response = remote.ref_storage.GetReference(request) @@ -238,6 +240,7 @@ class CASCache(ArtifactCache): except grpc.RpcError as e: if e.code() != grpc.StatusCode.NOT_FOUND: + element.info("{} not found at remote {}".format(element._get_brief_display_key(), remote.spec.url)) raise return False @@ -262,6 +265,8 @@ class CASCache(ArtifactCache): for remote in push_remotes: remote.init() + element.info("Pushing {} -> {}".format(element._get_brief_display_key(), remote.spec.url)) + try: for ref in refs: tree = self.resolve_ref(ref) @@ -275,6 +280,8 @@ class CASCache(ArtifactCache): if response.digest.hash == tree.hash and response.digest.size_bytes == tree.size_bytes: # ref is already on the server with the same tree + element.info("Skipping {}, remote ({}) already has artifact cached".format( + element._get_brief_display_key(), remote.spec.url)) continue except grpc.RpcError as e: diff --git a/buildstream/element.py b/buildstream/element.py index 5da14a93d..4b23e0ece 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -613,7 +613,7 @@ class Element(Plugin): # Time to use the artifact, check once more that it's there self.__assert_cached() - with self.timed_activity("Staging {}/{}".format(self.name, self.__get_brief_display_key())): + with self.timed_activity("Staging {}/{}".format(self.name, self._get_brief_display_key())): # Get the extracted artifact artifact_base, _ = self.__extract() artifact = os.path.join(artifact_base, 'files') @@ -1148,6 +1148,19 @@ class Element(Plugin): length = min(len(cache_key), context.log_key_length) return (cache_key, cache_key[0:length], dim_key) + # _get_brief_display_key() + # + # Returns an abbreviated cache key for display purposes + # + # Returns: + # (str): An abbreviated hex digest cache key for this Element + # + # Question marks are returned if information for the cache key is missing. + # + def _get_brief_display_key(self): + _, display_key, _ = self._get_display_key() + return display_key + # _preflight(): # # A wrapper for calling the abstract preflight() method on @@ -1622,7 +1635,7 @@ class Element(Plugin): return False # Notify successfull download - display_key = self.__get_brief_display_key() + display_key = self._get_brief_display_key() self.info("Downloaded artifact {}".format(display_key)) return True @@ -1662,14 +1675,14 @@ class Element(Plugin): self.warn("Not pushing tainted artifact.") return False - with self.timed_activity("Pushing artifact"): + display_key = self._get_brief_display_key() + with self.timed_activity("Pushing artifact {}".format(display_key)): # Push all keys used for local commit pushed = self.__artifacts.push(self, self.__get_cache_keys_for_commit()) if not pushed: return False # Notify successful upload - display_key = self.__get_brief_display_key() self.info("Pushed artifact {}".format(display_key)) return True @@ -1945,19 +1958,6 @@ class Element(Plugin): def __can_build_incrementally(self): return bool(self._get_workspace()) - # __get_brief_display_key(): - # - # Returns an abbreviated cache key for display purposes - # - # Returns: - # (str): An abbreviated hex digest cache key for this Element - # - # Question marks are returned if information for the cache key is missing. - # - def __get_brief_display_key(self): - _, display_key, _ = self._get_display_key() - return display_key - # __prepare(): # # Internal method for calling public abstract prepare() method. @@ -1980,7 +1980,7 @@ class Element(Plugin): # Raises an error if the artifact is not cached. # def __assert_cached(self): - assert self._cached(), "{}: Missing artifact {}".format(self, self.__get_brief_display_key()) + assert self._cached(), "{}: Missing artifact {}".format(self, self._get_brief_display_key()) # __get_tainted(): # |