bazelbuild / bazelbuild/bazel

tags=["exclusive-if-local"] limits concurrency when running remotely

Open
#17,834 6 comments 2 reactions 1 assignee Claimed by @susinmotion View on GitHub
team-Remote-Exec type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

Commit 8936828610db8106864e41860ad86c5c415fa0ed added `tags=["exclusive-if-local"]`, which can be used to only limit the concurrency of a test, if and only if it runs locally. When running remotely, it should be permitted to run at full concurrency.

Unfortunately, it looks like only one default implementation of `forceExclusiveIfLocalTestsInParallel()` is provided, and that one always returns false. This means that if remote execution is used using `--remote_executor`, it will also limit concurrency. This is obviously not intended.

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

WORKSPACE
```python
register_execution_platforms("//:linux_x86_64")
```
BUILD
```python
platform(
name = "linux_x86_64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
remote_execution_properties = """
Your platform properties go here
""",
)

sh_test(
name = "foo_test",
srcs = ["foo_test.sh"],
#tags = ["exclusive-if-local"],
)
```
foo_test.sh
```sh
#!/bin/sh
echo it worked
```
Then run a command like this:
```
bazel test --remote_executor=... --remote_instance_name=... :foo_test --runs_per_test 10000
```
On my laptop this will run 16 tests in parallel. But if I uncomment the `tags =` argument, it limits it to just 1 test.

### Which operating system are you running Bazel on?

macOS Ventura

### What is the output of `bazel info release`?

release 6.1.1

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.