Skip to content

Remote: Register "remote" strategy even if remote execution is not available.#13490

Closed
coeuvre wants to merge 3 commits intobazelbuild:masterfrom
coeuvre:remote-strategy-placeholder
Closed

Remote: Register "remote" strategy even if remote execution is not available.#13490
coeuvre wants to merge 3 commits intobazelbuild:masterfrom
coeuvre:remote-strategy-placeholder

Conversation

@coeuvre
Copy link
Copy Markdown
Member

@coeuvre coeuvre commented May 19, 2021

So that you can set a --spawn_strategy that includes remote without setting --remote_executor. In addition, if --remote_local_fallback is set and remote_executor is unreachable when build starts, Bazel will fallback to next available strategy.

Fixes #13340 and #13487.

@google-cla google-cla Bot added the cla: yes label May 19, 2021
@coeuvre coeuvre force-pushed the remote-strategy-placeholder branch from 90f3ece to 2d3ca7f Compare May 20, 2021 05:52
coeuvre added 3 commits May 20, 2021 15:01
…ailable.

So that you can set a `--spawn_strategy` that includes `remote` without set `--remote_executor`. In addition, if `--remote_local_fallback` is set and `remote_executor` is unreachable when build starts, Bazel will fallback to next available strategy.

Fixes bazelbuild#13340 and bazelbuild#13487.
@coeuvre coeuvre force-pushed the remote-strategy-placeholder branch from a4c2b64 to 7207586 Compare May 20, 2021 07:03
@coeuvre coeuvre marked this pull request as ready for review May 20, 2021 07:03
@coeuvre coeuvre requested a review from philwo May 20, 2021 07:03
@coeuvre coeuvre added the team-Remote-Exec Issues and PRs for the Execution (Remote) team label May 20, 2021
@coeuvre coeuvre self-assigned this May 20, 2021
@bazel-io bazel-io closed this in 7643d3a Jun 9, 2021
coeuvre added a commit to coeuvre/bazel that referenced this pull request Jul 15, 2021
…ailable.

So that you can set a `--spawn_strategy` that includes `remote` without setting `--remote_executor`. In addition, if `--remote_local_fallback` is set and `remote_executor` is unreachable when build starts, Bazel will fallback to next available strategy.

Fixes bazelbuild#13340 and bazelbuild#13487.

Closes bazelbuild#13490.

PiperOrigin-RevId: 378339904
coeuvre added a commit to coeuvre/bazel that referenced this pull request Jul 15, 2021
…ailable.

So that you can set a `--spawn_strategy` that includes `remote` without setting `--remote_executor`. In addition, if `--remote_local_fallback` is set and `remote_executor` is unreachable when build starts, Bazel will fallback to next available strategy.

Fixes bazelbuild#13340 and bazelbuild#13487.

Closes bazelbuild#13490.

PiperOrigin-RevId: 378339904
coeuvre added a commit to coeuvre/bazel that referenced this pull request Jul 15, 2021
…ailable.

So that you can set a `--spawn_strategy` that includes `remote` without setting `--remote_executor`. In addition, if `--remote_local_fallback` is set and `remote_executor` is unreachable when build starts, Bazel will fallback to next available strategy.

Fixes bazelbuild#13340 and bazelbuild#13487.

Closes bazelbuild#13490.

PiperOrigin-RevId: 378339904
coeuvre added a commit to coeuvre/bazel that referenced this pull request Jul 15, 2021
…ailable.

So that you can set a `--spawn_strategy` that includes `remote` without setting `--remote_executor`. In addition, if `--remote_local_fallback` is set and `remote_executor` is unreachable when build starts, Bazel will fallback to next available strategy.

Fixes bazelbuild#13340 and bazelbuild#13487.

Closes bazelbuild#13490.

PiperOrigin-RevId: 378339904
coeuvre added a commit to coeuvre/bazel that referenced this pull request Jul 16, 2021
…ailable.

So that you can set a `--spawn_strategy` that includes `remote` without setting `--remote_executor`. In addition, if `--remote_local_fallback` is set and `remote_executor` is unreachable when build starts, Bazel will fallback to next available strategy.

Fixes bazelbuild#13340 and bazelbuild#13487.

Closes bazelbuild#13490.

PiperOrigin-RevId: 378339904
gh-worker-dd-mergequeue-cf854d Bot pushed a commit to DataDog/datadog-agent that referenced this pull request Mar 31, 2026
…7945)

### What does this PR do?
Adjust the `cache` Bazel config following a complete review of the remote flags:
1. switch `--remote_executor` to `--remote_cache` since RBE infrastructure is not ready,
2. add `--incompatible_remote_local_fallback_for_remote_cache` to enable local fallback on remote cache failures,
3. remove `--remote_local_fallback_strategy=sandboxed` from the `linux` and `macos` configs, which became dead letter.

### Motivation
[Earlier discussion](https://dd.slack.com/archives/C08SK4B0FK8/p1773737357223759).

#### 1. `--remote_executor` to `--remote_cache`
The build farm is used as a remote cache, not a remote executor.
[Quoting](#47945 (comment)) @JSGette, who filed bazelbuild/bazel#29129:
> fallback is basically broken for remote executor if an endpoint is unavailable **before** the build. So if buildbarn was to fail **during** the build Bazel would just continue locally.

#### 2. `--incompatible_remote_local_fallback_for_remote_cache`
The flag was introduced with Bazel 8.5.1 (bazelbuild/bazel#27996) since `--remote_local_fallback` alone does not cover cache-layer failures.
Both flags are required because [they are AND-gated at the single decision point](https://github.com/bazelbuild/bazel/blob/9.0.1/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java#L191):
```java
          boolean shouldLocalFallback =
              options.remoteLocalFallbackForRemoteCache && options.remoteLocalFallback;
```
Without **both** flags, a `RemoteExecutionCapabilitiesException` (capabilities fetch failure) causes a hard build failure instead of a local fallback.

#### 3. `--remote_local_fallback_strategy` removal
The flag is unreachable in a `--remote_cache`-only setup: its single call site is `RemoteSpawnRunner.execLocally()`, gated by `RemoteExecutionService.mayBeExecutedRemotely()`, which requires `remoteExecutor != null`.
It is also `@Deprecated` (bazelbuild/bazel#7480).

### Describe how you validated your changes
The flag is a no-op outside `--config=cache` (local builds unaffected by default), but CI benefits from it by default.

### Additional Notes
The stale `registerRemoteSpawnStrategy()` javadoc (["otherwise does nothing"](https://github.com/bazelbuild/bazel/blob/9.0.1/src/main/java/com/google/devtools/build/lib/remote/RemoteActionContextProvider.java#L195-L196) when no executor is set) is a known source-reading hazard: the null-check was deliberately removed in bazelbuild/bazel#13490 (2021), moving the guard to `canExec()`.
The javadoc was never updated.

Co-authored-by: regis.desgroppes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should be allowed to set remote --spawn_strategy without remote_executor set

2 participants