diff options
author | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-06-18 17:52:52 +0100 |
---|---|---|
committer | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-06-26 09:34:16 +0100 |
commit | 516bfb3c24e675b553c1dc8128ef9df89c5bc5e7 (patch) | |
tree | bfd3f40b970089a47b79f0392b9597cffdfc10da | |
parent | adc03c65025a701cf5a84200996fccdb1c63af23 (diff) | |
download | buildstream-516bfb3c24e675b553c1dc8128ef9df89c5bc5e7.tar.gz |
_sandboxbwrap: Create Command object, put it into local CAS and push it
-rw-r--r-- | buildstream/sandbox/_sandboxbwrap.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/buildstream/sandbox/_sandboxbwrap.py b/buildstream/sandbox/_sandboxbwrap.py index 79d62b49c..137d024be 100644 --- a/buildstream/sandbox/_sandboxbwrap.py +++ b/buildstream/sandbox/_sandboxbwrap.py @@ -34,6 +34,7 @@ from ._mount import MountMap from . import Sandbox, SandboxFlags from ..storage._filebaseddirectory import FileBasedDirectory from ..storage._casbaseddirectory import CasBasedDirectory +from google.devtools.remoteexecution.v1test import remote_execution_pb2, remote_execution_pb2_grpc from .._artifactcache.cascache import CASCache # SandboxBwrap() @@ -89,6 +90,22 @@ class SandboxBwrap(Sandbox): if isinstance(command, str): command = [command] + # Now transmit the command to execute + remote_command = remote_execution_pb2.Command(arguments=command) + # (Ignore environment for now) + # Serialise this into the cascache... + digest = cascache.add_object(buffer=remote_command.SerializeToString()) + + command_ref = 'worker-command/{}'.format(digest.hash) + cascache.set_ref(command_ref, digest) + print("Pushing key from local to remote: {}".format(command_ref)) + + # TODO: push_key_only isn't really meant to work with refs to Command + # objects - it will try and find the dependencies of it; there are none, + # but it expects to find a directory. We may need to pass a flag to tell + # it not to look for any. + cascache.push_key_only(command_ref, self._get_project()) + # Create the mount map, this will tell us where # each mount point needs to be mounted from and to mount_map = MountMap(self, flags & SandboxFlags.ROOT_READ_ONLY) |