summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Smith <joshsmith@codethink.co.uk>2018-07-23 14:59:42 +0100
committerQinusty <jrsmith9822@gmail.com>2018-08-01 14:17:17 +0000
commit0756c61569050e98fae4005278d51717024b82fa (patch)
tree009375bce1baac4b4d8b70b4d047bb769ea4fce5
parent60ddb193926b52fccc878d97c72dc3ba0b2102f9 (diff)
downloadbuildstream-0756c61569050e98fae4005278d51717024b82fa.tar.gz
cascache.py: Display SKIPPED message for each remote skippedQinusty/481
-rw-r--r--buildstream/_artifactcache/cascache.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 3ef563368..1b2dc198f 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -32,6 +32,7 @@ from .._protos.google.bytestream import bytestream_pb2, bytestream_pb2_grpc
from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc
from .._protos.buildstream.v2 import buildstream_pb2, buildstream_pb2_grpc
+from .._message import MessageType, Message
from .. import _signals, utils
from .._exceptions import ArtifactError
@@ -264,7 +265,7 @@ class CASCache(ArtifactCache):
for remote in push_remotes:
remote.init()
-
+ skipped_remote = True
element.info("Pushing {} -> {}".format(element._get_brief_display_key(), remote.spec.url))
try:
@@ -280,8 +281,6 @@ 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:
@@ -309,6 +308,7 @@ class CASCache(ArtifactCache):
missing_blobs[d.hash] = d
# Upload any blobs missing on the server
+ skipped_remote = False
for digest in missing_blobs.values():
def request_stream():
resource_name = os.path.join(digest.hash, str(digest.size_bytes))
@@ -344,6 +344,13 @@ class CASCache(ArtifactCache):
if e.code() != grpc.StatusCode.RESOURCE_EXHAUSTED:
raise ArtifactError("Failed to push artifact {}: {}".format(refs, e), temporary=True) from e
+ if skipped_remote:
+ self.context.message(Message(
+ None,
+ MessageType.SKIPPED,
+ "Remote ({}) already has {} cached".format(
+ remote.spec.url, element._get_brief_display_key())
+ ))
return pushed
################################################