Compute RBE -j instead of hardcoding
Change-Id: Ic2f4e27bacbe136598c13cec14e1d9805926aeca
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/58560
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Christopher Fujino <fujino@google.com>
diff --git a/recipe_modules/build_util/api.py b/recipe_modules/build_util/api.py
index 9c1fb42..e46d0ed 100644
--- a/recipe_modules/build_util/api.py
+++ b/recipe_modules/build_util/api.py
@@ -46,13 +46,10 @@
"""Calculates concurrent jobs value for the current machine."""
cores = multiprocessing.cpu_count()
- # For non goma builds, set -j to the number of cores.
- if not self.use_goma:
+ # For non goma/rbe builds, set -j to the number of cores.
+ if not self.use_goma and not self.use_rbe:
return 5 if self._test_data.enabled else cores
- # Assume simultaneous multithreading and therefore half as many cores as
- # logical processors.
- cores //= 2
default_core_multiplier = 80
j_value = cores * default_core_multiplier
if self.m.platform.is_win:
@@ -79,7 +76,7 @@
"""
assert rbe_working_path
build_dir = checkout_path.join('out/%s' % config)
- rbe_jobs = self.m.properties.get('rbe_jobs') or self._calculate_j_value()
+ rbe_jobs = self._calculate_j_value()
ninja_args = [tool, '-j', rbe_jobs, '-C', build_dir]
ninja_args.extend(targets)
with self.m.rbe(
diff --git a/recipe_modules/build_util/examples/full.expected/basic.json b/recipe_modules/build_util/examples/full.expected/basic.json
index f6879ae..c5b9f03 100644
--- a/recipe_modules/build_util/examples/full.expected/basic.json
+++ b/recipe_modules/build_util/examples/full.expected/basic.json
@@ -812,7 +812,7 @@
"cmd": [
"[START_DIR]/flutter/third_party/ninja/ninja",
"-j",
- "5",
+ "200",
"-C",
"[START_DIR]/out/release",
"rbe_target"
diff --git a/recipe_modules/build_util/examples/full.expected/mac.json b/recipe_modules/build_util/examples/full.expected/mac.json
index 6f38404..ea8d018 100644
--- a/recipe_modules/build_util/examples/full.expected/mac.json
+++ b/recipe_modules/build_util/examples/full.expected/mac.json
@@ -812,7 +812,7 @@
"cmd": [
"[START_DIR]/flutter/third_party/ninja/ninja",
"-j",
- "5",
+ "200",
"-C",
"[START_DIR]/out/release",
"rbe_target"