summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-04-01 12:05:34 +0200
committerJürg Billeter <j@bitron.ch>2019-04-12 11:17:33 +0200
commit403b41a598160b374219a4c0fbc75f08a1bbb37a (patch)
tree33f1a97b270259af076abb6eb8c0c32e481917a8
parent417a9fb231abac5c85e57b8216fe2d6012740045 (diff)
downloadbuildstream-403b41a598160b374219a4c0fbc75f08a1bbb37a.tar.gz
_sandboxremote.py: Fetch output file blobs after pull_tree()
This allows skipping file download in pull_tree()/_fetch_tree() and is preparation for conditional output file fetching.
-rw-r--r--buildstream/sandbox/_sandboxremote.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/buildstream/sandbox/_sandboxremote.py b/buildstream/sandbox/_sandboxremote.py
index ffd53f0d0..46a3db527 100644
--- a/buildstream/sandbox/_sandboxremote.py
+++ b/buildstream/sandbox/_sandboxremote.py
@@ -277,7 +277,7 @@ class SandboxRemote(Sandbox):
cascache = context.get_cascache()
casremote = CASRemote(self.storage_remote_spec)
- # Now do a pull to ensure we have the necessary parts.
+ # Now do a pull to ensure we have the full directory structure.
dir_digest = cascache.pull_tree(casremote, tree_digest)
if dir_digest is None or not dir_digest.hash or not dir_digest.size_bytes:
raise SandboxError("Output directory structure pulling from remote failed.")
@@ -289,6 +289,14 @@ class SandboxRemote(Sandbox):
new_dir = CasBasedDirectory(context.artifactcache.cas, digest=dir_digest)
self._set_virtual_directory(new_dir)
+ # Fetch the file blobs
+ required_blobs = cascache.required_blobs_for_directory(dir_digest)
+ local_missing_blobs = cascache.local_missing_blobs(required_blobs)
+ remote_missing_blobs = cascache.fetch_blobs(casremote, local_missing_blobs)
+ if remote_missing_blobs:
+ raise SandboxError("{} output files are missing on the CAS server"
+ .format(len(remote_missing_blobs)))
+
def _run(self, command, flags, *, cwd, env):
stdout, stderr = self._get_output()