bazelbuild / bazelbuild/bazel

Dynamic execution ignores exec constraints

Open
#25,221 4 comments 0 reactions 0 assignees View on GitHub
P3 team-Local-Exec type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

We have a test target like this:

```bzl
foo_test(
name = "foo",
exec_group_compatible_with = {
"test": ["//:some_gpu_requirement"],
}
...
)
```

When developers compile on CPU machines, where the host platform _does not_ have the `//:some_gpu_requirement`, but a register remote execution platform does have the constraint, I believe dynamic execution ignores this difference, and still attempts to race the test locally, even though it doesn't match the requirements.

I can probably workaround this by disabling dynamic execution for the `TestRunner` mnemonic, but I'm still surprised by this behavior.

If I `aquery` the test I can see the execution platform is set correctly, but then you can see it still runs locally with `--debug_spawn_scheduler`

```
INFO: Analyzed target //Support/test:system-info/system-info.mlir.test (0 packages loaded, 12 targets and 2 aspects configured).
INFO: local branch of Support/test/system-info/system-info.mlir.test/test.log finished and was not cancelled
INFO: CancellationException of remote branch of Support/test/system-info/system-info.mlir.test/test.log, returning null
INFO: local branch of Support/test/system-info/system-info.mlir.test/test.log finished and was not cancelled
INFO: CancellationException of remote branch of Support/test/system-info/system-info.mlir.test/test.log, returning null
```

### Which category does this issue belong to?

_No response_

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

_No response_

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

Linux

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

b4c611b0aab5d75af9d9a00755acbc3d6451b9ab

### 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 HEAD` ?

```text

```

### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

_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

Research direction

Start by reproducing the test target with exec_group_compatible_with and compare dynamic execution logs from --debug_spawn_scheduler with the execution platform shown by aquery. Trace the TestRunner mnemonic and constraint handling, then verify that a local branch is not started when the local platform lacks the required constraint; no source files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.