Raoul Hidalgo Charman pushed to branch raoul/627-RE-instance-config at BuildStream / buildstream
Commits:
-
95015192
by Raoul Hidalgo Charman at 2018-11-19T18:02:54Z
3 changed files:
Changes:
... | ... | @@ -131,6 +131,7 @@ class Project(): |
131 | 131 |
|
132 | 132 |
self.artifact_cache_specs = None
|
133 | 133 |
self.remote_execution_url = None
|
134 |
+ self.remote_execution_instance = None
|
|
134 | 135 |
self._sandbox = None
|
135 | 136 |
self._splits = None
|
136 | 137 |
|
... | ... | @@ -494,8 +495,9 @@ class Project(): |
494 | 495 |
|
495 | 496 |
# Load remote-execution configuration for this project
|
496 | 497 |
remote_execution = _yaml.node_get(config, Mapping, 'remote-execution')
|
497 |
- _yaml.node_validate(remote_execution, ['url'])
|
|
498 |
+ _yaml.node_validate(remote_execution, ['url', 'instance'])
|
|
498 | 499 |
self.remote_execution_url = _yaml.node_get(remote_execution, str, 'url')
|
500 |
+ self.remote_execution_instance = _yaml.node_get(remote_execution, str, 'instance')
|
|
499 | 501 |
|
500 | 502 |
# Load sandbox environment variables
|
501 | 503 |
self.base_environment = _yaml.node_get(config, Mapping, 'environment')
|
... | ... | @@ -199,4 +199,5 @@ shell: |
199 | 199 |
command: [ 'sh', '-i' ]
|
200 | 200 |
|
201 | 201 |
remote-execution:
|
202 |
- url: ""
|
|
\ No newline at end of file | ||
202 |
+ url: ""
|
|
203 |
+ instance: ""
|
... | ... | @@ -51,6 +51,7 @@ class SandboxRemote(Sandbox): |
51 | 51 |
"Only plain HTTP is currenlty supported (no HTTPS).")
|
52 | 52 |
|
53 | 53 |
self.server_url = '{}:{}'.format(url.hostname, url.port)
|
54 |
+ self.server_instance = self._get_project().remote_execution_instance
|
|
54 | 55 |
|
55 | 56 |
def run_remote_command(self, command, input_root_digest, working_directory, environment):
|
56 | 57 |
# Sends an execution request to the remote execution server.
|
... | ... | @@ -89,7 +90,8 @@ class SandboxRemote(Sandbox): |
89 | 90 |
# Next, try to create a communication channel to the BuildGrid server.
|
90 | 91 |
channel = grpc.insecure_channel(self.server_url)
|
91 | 92 |
stub = remote_execution_pb2_grpc.ExecutionStub(channel)
|
92 |
- request = remote_execution_pb2.ExecuteRequest(action_digest=action_digest,
|
|
93 |
+ request = remote_execution_pb2.ExecuteRequest(instance_name=self.server_instance,
|
|
94 |
+ action_digest=action_digest,
|
|
93 | 95 |
skip_cache_lookup=False)
|
94 | 96 |
|
95 | 97 |
def __run_remote_command(stub, execute_request=None, running_operation=None):
|