finn pushed to branch finn/cli-time-period at BuildGrid / buildgrid
Commits:
6 changed files:
- buildgrid/_app/bots/temp_directory.py → buildgrid/_app/bots/host.py
- buildgrid/_app/commands/cmd_bot.py
- docs/source/reference_cli.rst
- docs/source/using_bazel.rst
- docs/source/using_internal.rst
- docs/source/using_recc.rst
Changes:
... | ... | @@ -24,7 +24,7 @@ from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_p |
24 | 24 |
from buildgrid.utils import output_file_maker, output_directory_maker
|
25 | 25 |
|
26 | 26 |
|
27 |
-def work_temp_directory(context, lease):
|
|
27 |
+def work_host_tools(context, lease):
|
|
28 | 28 |
"""Executes a lease for a build action, using host tools.
|
29 | 29 |
"""
|
30 | 30 |
|
... | ... | @@ -31,7 +31,7 @@ import grpc |
31 | 31 |
from buildgrid.bot import bot, bot_interface
|
32 | 32 |
from buildgrid.bot.bot_session import BotSession, Device, Worker
|
33 | 33 |
|
34 |
-from ..bots import buildbox, dummy, temp_directory
|
|
34 |
+from ..bots import buildbox, dummy, host
|
|
35 | 35 |
from ..cli import pass_context
|
36 | 36 |
|
37 | 37 |
|
... | ... | @@ -52,16 +52,19 @@ from ..cli import pass_context |
52 | 52 |
help="Public CAS client certificate for TLS (PEM-encoded)")
|
53 | 53 |
@click.option('--cas-server-cert', type=click.Path(exists=True, dir_okay=False), default=None,
|
54 | 54 |
help="Public CAS server certificate for TLS (PEM-encoded)")
|
55 |
+@click.option('--update-period', type=click.FLOAT, default=0.5, show_default=True,
|
|
56 |
+ help="Time period for bot updates to the server in seconds.")
|
|
55 | 57 |
@click.option('--parent', type=click.STRING, default='main', show_default=True,
|
56 | 58 |
help="Targeted farm resource.")
|
57 | 59 |
@pass_context
|
58 |
-def cli(context, parent, remote, client_key, client_cert, server_cert,
|
|
60 |
+def cli(context, parent, update_period, remote, client_key, client_cert, server_cert,
|
|
59 | 61 |
remote_cas, cas_client_key, cas_client_cert, cas_server_cert):
|
60 | 62 |
# Setup the remote execution server channel:
|
61 | 63 |
url = urlparse(remote)
|
62 | 64 |
|
63 | 65 |
context.remote = '{}:{}'.format(url.hostname, url.port or 50051)
|
64 | 66 |
context.remote_url = remote
|
67 |
+ context.update_period = update_period
|
|
65 | 68 |
context.parent = parent
|
66 | 69 |
|
67 | 70 |
if url.scheme == 'http':
|
... | ... | @@ -135,26 +138,26 @@ def cli(context, parent, remote, client_key, client_cert, server_cert, |
135 | 138 |
@pass_context
|
136 | 139 |
def run_dummy(context):
|
137 | 140 |
"""
|
138 |
- Simple dummy client. Creates a session, accepts leases, does fake work and
|
|
139 |
- updates the server.
|
|
141 |
+ Creates a session, accepts leases, does fake work and updates the server.
|
|
140 | 142 |
"""
|
141 | 143 |
try:
|
142 |
- b = bot.Bot(context.bot_session)
|
|
144 |
+ b = bot.Bot(context.bot_session, context.update_period)
|
|
143 | 145 |
b.session(dummy.work_dummy,
|
144 | 146 |
context)
|
145 | 147 |
except KeyboardInterrupt:
|
146 | 148 |
pass
|
147 | 149 |
|
148 | 150 |
|
149 |
-@cli.command('temp-directory', short_help="Runs commands in temp directory and uploads results.")
|
|
151 |
+@cli.command('host-tools', short_help="Runs commands using the host's tools.")
|
|
150 | 152 |
@pass_context
|
151 |
-def run_temp_directory(context):
|
|
152 |
- """ Downloads files and command from CAS and runs
|
|
153 |
- in a temp directory, uploading result back to CAS
|
|
153 |
+def run_host_tools(context):
|
|
154 |
+ """
|
|
155 |
+ Downloads inputs from CAS, runs build commands using host-tools and uploads
|
|
156 |
+ result back to CAS.
|
|
154 | 157 |
"""
|
155 | 158 |
try:
|
156 | 159 |
b = bot.Bot(context.bot_session)
|
157 |
- b.session(temp_directory.work_temp_directory,
|
|
160 |
+ b.session(host.work_host_tools,
|
|
158 | 161 |
context)
|
159 | 162 |
except KeyboardInterrupt:
|
160 | 163 |
pass
|
... | ... | @@ -168,7 +171,7 @@ def run_temp_directory(context): |
168 | 171 |
@pass_context
|
169 | 172 |
def run_buildbox(context, local_cas, fuse_dir):
|
170 | 173 |
"""
|
171 |
- Uses BuildBox to run commands.
|
|
174 |
+ Uses BuildBox to run build commands.
|
|
172 | 175 |
"""
|
173 | 176 |
context.local_cas = local_cas
|
174 | 177 |
context.fuse_dir = fuse_dir
|
... | ... | @@ -36,10 +36,10 @@ BuildGrid's Command Line Interface (CLI) reference documentation. |
36 | 36 |
|
37 | 37 |
----
|
38 | 38 |
|
39 |
-.. _invoking-bgd-bot-temp-directory:
|
|
39 |
+.. _invoking-bgd-bot-host-tools:
|
|
40 | 40 |
|
41 |
-.. click:: buildgrid._app.commands.cmd_bot:run_temp_directory
|
|
42 |
- :prog: bgd bot temp-directory
|
|
41 |
+.. click:: buildgrid._app.commands.cmd_bot:run_host_tools
|
|
42 |
+ :prog: bgd bot host-tools
|
|
43 | 43 |
|
44 | 44 |
----
|
45 | 45 |
|
... | ... | @@ -137,4 +137,4 @@ BuildGrid's Command Line Interface (CLI) reference documentation. |
137 | 137 |
.. _invoking-bgd-server-start:
|
138 | 138 |
|
139 | 139 |
.. click:: buildgrid._app.commands.cmd_server:start
|
140 |
- :prog: bgd server start
|
|
140 |
+ :prog: bgd server start
|
|
\ No newline at end of file |
... | ... | @@ -94,12 +94,12 @@ has ``gcc`` installed, run: |
94 | 94 |
|
95 | 95 |
.. code-block:: sh
|
96 | 96 |
|
97 |
- bgd bot --remote=http://localhost:50051 --parent=main temp-directory
|
|
97 |
+ bgd bot --remote=http://localhost:50051 --parent=main host-tools
|
|
98 | 98 |
|
99 | 99 |
The ``--remote`` option is used to specify the server location (running on the
|
100 | 100 |
same machine here, and listening to port 50051). The ``--parent`` option is used
|
101 | 101 |
to specify the server instance you expect the bot to be attached to. Refer to
|
102 |
-the :ref:`CLI reference section <invoking-bgd-bot-temp-directory>` for command
|
|
102 |
+the :ref:`CLI reference section <invoking-bgd-bot-host-tools>` for command
|
|
103 | 103 |
line interface details.
|
104 | 104 |
|
105 | 105 |
The BuildGrid server is now ready to accept jobs and execute them. Bazel needs
|
... | ... | @@ -128,4 +128,4 @@ generated executable. Simply invoke: |
128 | 128 |
./bazel-bin/main/hello-world
|
129 | 129 |
|
130 | 130 |
.. _bazel-examples: https://github.com/bazelbuild/examples
|
131 |
-.. _stage3 CPP example: https://github.com/bazelbuild/examples/tree/master/cpp-tutorial/stage3
|
|
131 |
+.. _stage3 CPP example: https://github.com/bazelbuild/examples/tree/master/cpp-tutorial/stage3
|
|
\ No newline at end of file |
1 |
+ |
|
1 | 2 |
.. _internal-client:
|
2 | 3 |
|
3 | 4 |
Internal client
|
... | ... | @@ -83,7 +84,7 @@ Start the following bot session: |
83 | 84 |
|
84 | 85 |
.. code-block:: sh
|
85 | 86 |
|
86 |
- bgd bot temp-directory
|
|
87 |
+ bgd bot host-tools
|
|
87 | 88 |
|
88 | 89 |
Upload the directory containing the C file:
|
89 | 90 |
|
... | ... | @@ -101,4 +102,4 @@ to run on the bot: |
101 | 102 |
bgd execute command --output-file hello True /path/to/test-buildgrid -- gcc -Wall hello.c -o hello
|
102 | 103 |
|
103 | 104 |
The resulting executeable should have returned to a new directory called
|
104 |
-``testing``.
|
|
105 |
+``testing``.
|
|
\ No newline at end of file |
... | ... | @@ -103,12 +103,12 @@ to build the hello example program. Once you've make sure that your machine has |
103 | 103 |
|
104 | 104 |
.. code-block:: sh
|
105 | 105 |
|
106 |
- bgd bot --remote=http://localhost:50051 --parent=main temp-directory
|
|
106 |
+ bgd bot --remote=http://localhost:50051 --parent=main host-tools
|
|
107 | 107 |
|
108 | 108 |
The ``--remote`` option is used to specify the server location (running on the
|
109 | 109 |
same machine here, and listening to port 50051). The ``--parent`` option is used
|
110 | 110 |
to specify the server instance you expect the bot to be attached to. Refer to
|
111 |
-the :ref:`CLI reference section <invoking-bgd-bot-temp-directory>` for command
|
|
111 |
+the :ref:`CLI reference section <invoking-bgd-bot-host-tools>` for command
|
|
112 | 112 |
line interface details.
|
113 | 113 |
|
114 | 114 |
The BuildGrid server is now ready to accept jobs and execute them. RECC's
|