Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to force Bazel to run tests serially

By default, Bazel runs tests in a parallel fashion to speed things up. However, I have a resource (GPU) that can't handle parallel jobs due to the GPU memory limit. Is there a way to force Bazel to run tests in a serial, i.e., non-parallel way?

Thanks.

like image 267
Shanqing Cai Avatar asked Jan 29 '16 17:01

Shanqing Cai


2 Answers

--jobs 1 will limit the number of parallel jobs Bazel runs to 1.

You can also modify the test targets and add tags = ["exclusive"] to prevent specific test to run in parallel (see http://bazel.io/docs/test-encyclopedia.html).

like image 86
Damien Martin-Guillerez Avatar answered Oct 11 '22 23:10

Damien Martin-Guillerez


Use --local_test_jobs=1 to only run a single test job at a time locally.

The max number of local test jobs to run concurrently. Takes an integer, or a keyword ("auto", "HOST_CPUS", "HOST_RAM"), optionally followed by an operation ([-|]) eg. "auto", "HOST_CPUS.5". 0 means local resources will limit the number of local test jobs to run concurrently instead. Setting this greater than the value for --jobs is ineffectual

  • tags = ["exclusive"] has other complications to consider with respect to caching.
  • --jobs will serialize the entire build process, not just testing, so it's less than ideal.
like image 3
Matt Robinson Avatar answered Oct 11 '22 23:10

Matt Robinson