summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-06-12 12:36:06 +0100
committerRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-06-21 11:09:07 +0100
commit6dab5bbf0e261064232c10a4efd8160b605515a5 (patch)
tree9a8bd0b905aceaba6cdf98d629e1b347be60275b
parent2d57e14bdd8ac83ddf054ee25c1b97ceb2a2bfaf (diff)
downloadbuildstream-6dab5bbf0e261064232c10a4efd8160b605515a5.tar.gz
_artifactcache.py: fix find_missing_blobs method
This never will have worked because digests aren't hashable, and this method wasn't being covered in any tests. Also changed `remote_missing_blobs` to ensure the blobs list is an iterator and updated its docs.
-rw-r--r--src/buildstream/_artifactcache.py9
-rw-r--r--src/buildstream/_cas/cascache.py4
2 files changed, 8 insertions, 5 deletions
diff --git a/src/buildstream/_artifactcache.py b/src/buildstream/_artifactcache.py
index de17ea7ac..4a502064f 100644
--- a/src/buildstream/_artifactcache.py
+++ b/src/buildstream/_artifactcache.py
@@ -469,15 +469,18 @@ class ArtifactCache(BaseCache):
push_remotes = [r for r in self._remotes[project] if r.spec.push]
- remote_missing_blobs_set = set()
+ remote_missing_blobs_list = []
for remote in push_remotes:
remote.init()
remote_missing_blobs = self.cas.remote_missing_blobs(remote, missing_blobs)
- remote_missing_blobs_set.update(remote_missing_blobs)
- return list(remote_missing_blobs_set)
+ for blob in remote_missing_blobs:
+ if blob not in remote_missing_blobs_list:
+ remote_missing_blobs_list.append(blob)
+
+ return remote_missing_blobs_list
################################################
# Local Private Methods #
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py
index 58527d4cb..434e71663 100644
--- a/src/buildstream/_cas/cascache.py
+++ b/src/buildstream/_cas/cascache.py
@@ -596,14 +596,14 @@ class CASCache():
# Determine which blobs are missing on the remote.
#
# Args:
- # blobs (Digest): The directory digest
+ # blobs ([Digest]): List of directory digests to check
#
# Returns: List of missing Digest objects
#
def remote_missing_blobs(self, remote, blobs):
missing_blobs = dict()
# Limit size of FindMissingBlobs request
- for required_blobs_group in _grouper(blobs, 512):
+ for required_blobs_group in _grouper(iter(blobs), 512):
request = remote_execution_pb2.FindMissingBlobsRequest(instance_name=remote.spec.instance_name)
for required_digest in required_blobs_group: