Run a test alone: exclusive
The exclusive tag makes Bazel run the test with no other build or test action on the machine.
Use it when a few specific tests consume far more than the rest.
BUILD.bazel
Reserve CPU slots: cpu:N
The cpu:N tag reserves N CPU slots for the test. A higher N leaves fewer slots for other actions on the same machine, so it doubles as a memory reservation.
Use it when exclusive is too restrictive and you want to tune how much concurrency to give up.
BUILD.bazel
Declare a custom resource: resources:<name>:<amount>
For a resource Bazel doesn’t count, such as GPUs, declare how many the machine has and how many each test uses. Bazel then never runs more tests at once than the machine can hold.
BUILD.bazel
.bazelrc

