diff options
author | Jürg Billeter <j@bitron.ch> | 2019-03-13 16:04:27 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-27 16:24:32 +0000 |
commit | eff2394a4969207d77115aa757b04ebc10f49969 (patch) | |
tree | b08eab48cb5ff92b0e8bd0dcace3584a20cc0538 | |
parent | 052bdcc167162522252ac78d15b90e458260041e (diff) | |
download | buildstream-eff2394a4969207d77115aa757b04ebc10f49969.tar.gz |
casremote.py: Add missing_blobs parameter to _CASBatchRead.send()
This optionally returns a list of missing blobs instead of raising an
error.
-rw-r--r-- | buildstream/_cas/casremote.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/buildstream/_cas/casremote.py b/buildstream/_cas/casremote.py index 6ad3353ee..aac0d2802 100644 --- a/buildstream/_cas/casremote.py +++ b/buildstream/_cas/casremote.py @@ -322,7 +322,7 @@ class _CASBatchRead(): self._size = new_batch_size return True - def send(self): + def send(self, *, missing_blobs=None): assert not self._sent self._sent = True @@ -333,8 +333,12 @@ class _CASBatchRead(): for response in batch_response.responses: if response.status.code == code_pb2.NOT_FOUND: - raise BlobNotFound(response.digest.hash, "Failed to download blob {}: {}".format( - response.digest.hash, response.status.code)) + if missing_blobs is None: + raise BlobNotFound(response.digest.hash, "Failed to download blob {}: {}".format( + response.digest.hash, response.status.code)) + else: + missing_blobs.append(response.digest) + if response.status.code != code_pb2.OK: raise CASRemoteError("Failed to download blob {}: {}".format( response.digest.hash, response.status.code)) |