Run test build: Increase RBE parallelism
Use maximum parallelism if RBE is enabled.
Vast majority of compilations support RBE now, which means
that even with maximum parallelism we don't overload the system.
This halves new build time (e.g. after R8 update) while still
keeping the local CPU mostly idle during the build.
Test: Measure CPU usage during new build.
Change-Id: Iff880e6057a542abe859acda9bbc4057d1dcf443
diff --git a/test/run_test_build.py b/test/run_test_build.py
index c19b49b..1e4b25e 100755
--- a/test/run_test_build.py
+++ b/test/run_test_build.py
@@ -455,6 +455,8 @@
# We don't know which situation we are in, so as simple work-around, we use a lock
# file to allow only one shard to use multiprocessing at the same time.
def use_multiprocessing(mode: str) -> bool:
+ if "RBE_server_address" in os.environ:
+ return True
global lock_file
lock_path = Path(environ["TMPDIR"]) / ("art-test-run-test-build-py-" + mode)
lock_file = open(lock_path, "w")