summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Smith <qinusty@gmail.com>2018-09-19 10:14:00 +0100
committerJosh Smith <qinusty@gmail.com>2018-09-19 10:25:21 +0100
commit198fbfe81dd38027bf12720e916cf87ca597c04a (patch)
treec232c2221eeec9363ecc7b11587d72a4ad8b1f63
parentab56f693000f979f2c65ef6a85e3fb62256c2a06 (diff)
downloadbuildstream-198fbfe81dd38027bf12720e916cf87ca597c04a.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.py10
-rw-r--r--buildstream/element.py4
-rw-r--r--tests/testutils/runcli.py2
3 files changed, 7 insertions, 9 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 1a48c4065..ff47532da 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -228,8 +228,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
@@ -243,6 +243,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
@@ -336,10 +337,11 @@ class CASCache(ArtifactCache):
for remote in push_remotes:
remote.init()
-
- element.info("Pushing {} -> {}".format(element._get_brief_display_key(), remote.spec.url))
+ display_key = element._get_brief_display_key()
+ element.status("Pushing artifact {} -> {}".format(display_key, remote.spec.url))
if self._push_refs_to_remote(refs, remote):
+ element.info("Pushed artifact {} -> {}".format(display_key, remote.spec.url))
pushed = True
else:
self.context.message(Message(
diff --git a/buildstream/element.py b/buildstream/element.py
index d87e26a64..6bc400bb9 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1760,8 +1760,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():
@@ -1806,8 +1804,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 []