I have many large integration tests with Bazel defined with sh_test()
. Relevant attributes look like this:
sh_test(
name = "example_integration_test",
tags = ["cpu:6"],
size = "large",
flaky = True,
)
I pass the follow resource options to Bazel:
--jobs=HOST_CPUS
--local_resources=cpu=HOST_CPUS
--local_resources=memory=HOST_RAM
On a CI machine with 8 CPUs I’m finding Bazel most of the time running 4 actions at once. Here’s an example Bazel output where test names have been replaced with //:example_n_integration_test
:
(21:21:56) [2,681 / 2,705] 16 / 40 tests; 8 actions, 4 running; last test: //:example_1_integration_test
Testing //:example_2_integration_test; 519s linux-sandbox, remote-cache
Testing //:example_3_integration_test; 357s linux-sandbox, remote-cache
Testing //:example_4_integration_test; 82s linux-sandbox, remote-cache
Testing //:example_5_integration_test; 0s linux-sandbox, remote-cache
[Sched] Testing //:example_6_integration_test; 228s
[Sched] Testing //:example_7_integration_test; 205s
[Sched] Testing //:example_8_integration_test; 183s
[Sched] Testing //:example_9_integration_test; 159s
I’ve tried increasing the CPU tag to cpu:40
but I still get multiple tests running in parallel. Why is Bazel ignoring my CPU requirement tag? I’d expect given a CPU requirement of 6 then only one of these tests could run at once on an 8 core machine. What are these [Sched]
lines in the output? (I’m guessing they’re not running actions.) I’m running Bazel 7.2.0.