Jim MacArthur pushed to branch jmac/remote_execution_client at BuildStream / buildstream
Commits:
-
0379b6cb
by Jim MacArthur at 2018-08-21T16:30:25Z
-
aaa2d955
by Jim MacArthur at 2018-08-21T16:30:25Z
-
b903b941
by Jim MacArthur at 2018-08-21T16:30:25Z
-
64600e98
by Jim MacArthur at 2018-08-21T16:30:25Z
-
e86986f3
by Jim MacArthur at 2018-08-21T16:30:25Z
4 changed files:
- buildstream/element.py
- buildstream/plugins/elements/autotools.py
- buildstream/sandbox/__init__.py
- buildstream/sandbox/_sandboxremote.py
Changes:
| ... | ... | @@ -95,6 +95,7 @@ from . import _site |
| 95 | 95 |
from ._platform import Platform
|
| 96 | 96 |
from .plugin import CoreWarnings
|
| 97 | 97 |
from .sandbox._config import SandboxConfig
|
| 98 |
+from .sandbox._sandboxremote import SandboxRemote
|
|
| 98 | 99 |
|
| 99 | 100 |
from .storage.directory import Directory
|
| 100 | 101 |
from .storage._filebaseddirectory import FileBasedDirectory
|
| ... | ... | @@ -1548,6 +1549,8 @@ class Element(Plugin): |
| 1548 | 1549 |
finally:
|
| 1549 | 1550 |
if collect is not None:
|
| 1550 | 1551 |
try:
|
| 1552 |
+ # Sandbox will probably have replaced its virtual directory, so get it again
|
|
| 1553 |
+ sandbox_vroot = sandbox.get_virtual_directory()
|
|
| 1551 | 1554 |
collectvdir = sandbox_vroot.descend(collect.lstrip(os.sep).split(os.sep))
|
| 1552 | 1555 |
except VirtualDirectoryError:
|
| 1553 | 1556 |
# No collect directory existed
|
| ... | ... | @@ -2120,7 +2123,24 @@ class Element(Plugin): |
| 2120 | 2123 |
project = self._get_project()
|
| 2121 | 2124 |
platform = Platform.get_platform()
|
| 2122 | 2125 |
|
| 2123 |
- if directory is not None and os.path.exists(directory):
|
|
| 2126 |
+ if self.__remote_execution_url and self.BST_VIRTUAL_DIRECTORY:
|
|
| 2127 |
+ if not self.__artifacts.has_push_remotes(element=self):
|
|
| 2128 |
+ # Give an early warning if remote execution will not work
|
|
| 2129 |
+ raise ElementError("Artifact {} is configured to use remote execution but has no push remotes. "
|
|
| 2130 |
+ .format(self.name) +
|
|
| 2131 |
+ "The remote artifact server(s) may not be correctly configured or contactable.")
|
|
| 2132 |
+ |
|
| 2133 |
+ self.info("Using a remote 'sandbox' for artifact {}".format(self.name))
|
|
| 2134 |
+ sandbox = SandboxRemote(context, project,
|
|
| 2135 |
+ directory,
|
|
| 2136 |
+ stdout=stdout,
|
|
| 2137 |
+ stderr=stderr,
|
|
| 2138 |
+ config=config,
|
|
| 2139 |
+ server_url=self.__remote_execution_url,
|
|
| 2140 |
+ allow_real_directory=False)
|
|
| 2141 |
+ yield sandbox
|
|
| 2142 |
+ elif directory is not None and os.path.exists(directory):
|
|
| 2143 |
+ self.info("Using a local sandbox for artifact {}".format(self.name))
|
|
| 2124 | 2144 |
sandbox = platform.create_sandbox(context, project,
|
| 2125 | 2145 |
directory,
|
| 2126 | 2146 |
stdout=stdout,
|
| ... | ... | @@ -57,7 +57,7 @@ from buildstream import BuildElement |
| 57 | 57 |
|
| 58 | 58 |
# Element implementation for the 'autotools' kind.
|
| 59 | 59 |
class AutotoolsElement(BuildElement):
|
| 60 |
- pass
|
|
| 60 |
+ BST_VIRTUAL_DIRECTORY = True
|
|
| 61 | 61 |
|
| 62 | 62 |
|
| 63 | 63 |
# Plugin entry point
|
| ... | ... | @@ -20,3 +20,4 @@ |
| 20 | 20 |
from .sandbox import Sandbox, SandboxFlags
|
| 21 | 21 |
from ._sandboxchroot import SandboxChroot
|
| 22 | 22 |
from ._sandboxbwrap import SandboxBwrap
|
| 23 |
+from ._sandboxremote import SandboxRemote
|
| 1 | 1 |
#!/usr/bin/env python3
|
| 2 | 2 |
#
|
| 3 |
-# Copyright (C) 2018 Codethink Limited
|
|
| 3 |
+# Copyright (C) 2018 Bloomberg LP
|
|
| 4 | 4 |
#
|
| 5 | 5 |
# This program is free software; you can redistribute it and/or
|
| 6 | 6 |
# modify it under the terms of the GNU Lesser General Public
|
| ... | ... | @@ -27,7 +27,6 @@ from . import Sandbox |
| 27 | 27 |
from ..storage._filebaseddirectory import FileBasedDirectory
|
| 28 | 28 |
from ..storage._casbaseddirectory import CasBasedDirectory
|
| 29 | 29 |
from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc
|
| 30 |
- |
|
| 31 | 30 |
from .._artifactcache.cascache import CASCache
|
| 32 | 31 |
|
| 33 | 32 |
|
