diff options
author | Josh Smith <qinusty@gmail.com> | 2018-09-19 10:14:00 +0100 |
---|---|---|
committer | Josh Smith <qinusty@gmail.com> | 2018-09-20 09:30:23 +0100 |
commit | bb66744d654ae02087b0866061d25da317c592d5 (patch) | |
tree | 4a3375039387c38a11c677bc804860683ff5fac8 | |
parent | 0a314bb84a7615113f73786aa1f83eb294fb0be6 (diff) | |
download | buildstream-bb66744d654ae02087b0866061d25da317c592d5.tar.gz |
cascache.py: Move push/pull messaging to cascache
Pulled/Pushed messages will no longer be produced from within
element.py, instead they will be produced during CasCache push() and
pull() appropriately.
Message consistency has also been improved.
-rw-r--r-- | buildstream/_artifactcache/cascache.py | 12 | ||||
-rw-r--r-- | buildstream/element.py | 4 | ||||
-rw-r--r-- | tests/testutils/runcli.py | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py index 7d090e228..97bdedf56 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -225,8 +225,8 @@ class CASCache(ArtifactCache): for remote in self._remotes[project]: try: remote.init() - - element.info("Pulling {} <- {}".format(element._get_brief_display_key(), remote.spec.url)) + display_key = element._get_brief_display_key() + element.status("Pulling artifact {} <- {}".format(display_key, remote.spec.url)) request = buildstream_pb2.GetReferenceRequest() request.key = ref @@ -240,6 +240,7 @@ class CASCache(ArtifactCache): self.set_ref(ref, tree) + element.info("Pulled artifact {} <- {}".format(display_key, remote.spec.url)) # no need to pull from additional remotes return True @@ -273,11 +274,11 @@ class CASCache(ArtifactCache): push_remotes = [r for r in self._remotes[project] if r.spec.push] pushed = False - + display_key = element._get_brief_display_key() for remote in push_remotes: remote.init() skipped_remote = True - element.info("Pushing {} -> {}".format(element._get_brief_display_key(), remote.spec.url)) + element.status("Pushing artifact {} -> {}".format(display_key, remote.spec.url)) try: for ref in refs: @@ -354,6 +355,9 @@ class CASCache(ArtifactCache): pushed = True + if not skipped_remote: + element.info("Pushed artifact {} -> {}".format(display_key, remote.spec.url)) + except grpc.RpcError as e: if e.code() != grpc.StatusCode.RESOURCE_EXHAUSTED: raise ArtifactError("Failed to push artifact {}: {}".format(refs, e), temporary=True) from e diff --git a/buildstream/element.py b/buildstream/element.py index 1fefd6562..260762cf1 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -1672,8 +1672,6 @@ class Element(Plugin): return False # Notify successfull download - display_key = self._get_brief_display_key() - self.info("Downloaded artifact {}".format(display_key)) return True # _skip_push(): @@ -1718,8 +1716,6 @@ class Element(Plugin): return False # Notify successful upload - display_key = self._get_brief_display_key() - self.info("Pushed artifact {}".format(display_key)) return True # _shell(): diff --git a/tests/testutils/runcli.py b/tests/testutils/runcli.py index 8cd5bcb75..3535e94ea 100644 --- a/tests/testutils/runcli.py +++ b/tests/testutils/runcli.py @@ -178,7 +178,7 @@ class Result(): return list(pushed) def get_pulled_elements(self): - pulled = re.findall(r'\[\s*pull:(\S+)\s*\]\s*INFO\s*Downloaded artifact', self.stderr) + pulled = re.findall(r'\[\s*pull:(\S+)\s*\]\s*INFO\s*Pulled artifact', self.stderr) if pulled is None: return [] |