Add flag to run without building baked images.

Adds flag to :benchmarks to allow running without
building "baked images", which depends on gcloud.

Users can skip gcloud workflows using the following:

blaze run --define gcloud=off :benchmarks -- my-command-without-gcloud

"run-gcp" will not work with the flag set, but all other commands will.

PiperOrigin-RevId: 295627718
This commit is contained in:
gVisor bot
2020-02-17 15:02:20 -08:00
parent 5cc0bbbafb
commit fe92fb36ac
2 changed files with 26 additions and 15 deletions
+14 -4
View File
@@ -1,12 +1,22 @@
package(licenses = ["notice"])
config_setting(
name = "gcloud_rule",
values = {
"define": "gcloud=off",
},
)
py_binary(
name = "benchmarks",
srcs = ["run.py"],
data = [
"//tools/images:ubuntu1604",
"//tools/images:zone",
],
data = select({
":gcloud_rule": [],
"//conditions:default": [
"//tools/images:ubuntu1604",
"//tools/images:zone",
],
}),
main = "run.py",
python_version = "PY3",
srcs_version = "PY3",
+12 -11
View File
@@ -28,10 +28,12 @@ For configuring the environment manually, consult the
### Locally
Run the following from the benchmarks directory:
The tool is built to, by default, use Google Cloud Platform to run benchmarks,
but it does support GCP workflows. To run locally, run the following from the
benchmarks directory:
```bash
bazel run :benchmarks -- run-local startup
bazel run --define gcloud=off :benchmarks -- run-local startup
...
method,metric,result
@@ -46,17 +48,16 @@ runtime, runc. Running on another installed runtime, like say runsc, is as
simple as:
```bash
bazel run :benchmarks -- run-local startup --runtime=runsc
bazel run --define gcloud=off :benchmarks -- run-local startup --runtime=runsc
```
There is help: ``bash bash bazel run :benchmarks -- --help bazel
run :benchmarks -- run-local --help` ``
There is help: `bash bazel run --define gcloud=off :benchmarks -- --help bazel
run --define gcloud=off :benchmarks -- run-local --help`
To list available benchmarks, use the `list` commmand:
```bash
bazel run :benchmarks -- list
ls
bazel --define gcloud=off run :benchmarks -- list
...
Benchmark: sysbench.cpu
@@ -69,7 +70,7 @@ Metrics: events_per_second
You can choose benchmarks by name or regex like:
```bash
bazel run :benchmarks -- run-local startup.node
bazel run --define gcloud=off :benchmarks -- run-local startup.node
...
metric,result
startup_time_ms,1671.7178000000001
@@ -79,7 +80,7 @@ startup_time_ms,1671.7178000000001
or
```bash
bazel run :benchmarks -- run-local s
bazel run --define gcloud=off :benchmarks -- run-local s
...
method,metric,result
startup.empty,startup_time_ms,1792.8292
@@ -97,13 +98,13 @@ You can run parameterized benchmarks, for example to run with different
runtimes:
```bash
bazel run :benchmarks -- run-local --runtime=runc --runtime=runsc sysbench.cpu
bazel run --define gcloud=off :benchmarks -- run-local --runtime=runc --runtime=runsc sysbench.cpu
```
Or with different parameters:
```bash
bazel run :benchmarks -- run-local --max_prime=10 --max_prime=100 sysbench.cpu
bazel run --define gcloud=off :benchmarks -- run-local --max_prime=10 --max_prime=100 sysbench.cpu
```
### On Google Compute Engine (GCE)