... |
... |
@@ -32,6 +32,7 @@ from .._protos.google.bytestream import bytestream_pb2, bytestream_pb2_grpc |
32
|
32
|
from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc
|
33
|
33
|
from .._protos.buildstream.v2 import buildstream_pb2, buildstream_pb2_grpc
|
34
|
34
|
|
|
35
|
+from .._message import MessageType, Message
|
35
|
36
|
from .. import _signals, utils
|
36
|
37
|
from .._exceptions import ArtifactError
|
37
|
38
|
|
... |
... |
@@ -264,7 +265,7 @@ class CASCache(ArtifactCache): |
264
|
265
|
|
265
|
266
|
for remote in push_remotes:
|
266
|
267
|
remote.init()
|
267
|
|
-
|
|
268
|
+ skipped_remote = True
|
268
|
269
|
element.info("Pushing {} -> {}".format(element._get_brief_display_key(), remote.spec.url))
|
269
|
270
|
|
270
|
271
|
try:
|
... |
... |
@@ -280,8 +281,6 @@ class CASCache(ArtifactCache): |
280
|
281
|
|
281
|
282
|
if response.digest.hash == tree.hash and response.digest.size_bytes == tree.size_bytes:
|
282
|
283
|
# ref is already on the server with the same tree
|
283
|
|
- element.info("Skipping {}, remote ({}) already has artifact cached".format(
|
284
|
|
- element._get_brief_display_key(), remote.spec.url))
|
285
|
284
|
continue
|
286
|
285
|
|
287
|
286
|
except grpc.RpcError as e:
|
... |
... |
@@ -309,6 +308,7 @@ class CASCache(ArtifactCache): |
309
|
308
|
missing_blobs[d.hash] = d
|
310
|
309
|
|
311
|
310
|
# Upload any blobs missing on the server
|
|
311
|
+ skipped_remote = False
|
312
|
312
|
for digest in missing_blobs.values():
|
313
|
313
|
def request_stream():
|
314
|
314
|
resource_name = os.path.join(digest.hash, str(digest.size_bytes))
|
... |
... |
@@ -344,6 +344,13 @@ class CASCache(ArtifactCache): |
344
|
344
|
if e.code() != grpc.StatusCode.RESOURCE_EXHAUSTED:
|
345
|
345
|
raise ArtifactError("Failed to push artifact {}: {}".format(refs, e), temporary=True) from e
|
346
|
346
|
|
|
347
|
+ if skipped_remote:
|
|
348
|
+ self.context.message(Message(
|
|
349
|
+ None,
|
|
350
|
+ MessageType.SKIPPED,
|
|
351
|
+ "Remote ({}) already has {} cached".format(
|
|
352
|
+ remote.spec.url, element._get_brief_display_key())
|
|
353
|
+ ))
|
347
|
354
|
return pushed
|
348
|
355
|
|
349
|
356
|
################################################
|