Clean-up for list-based strategy selection
Removed unused code after list-based execution strategy was enabled by default
Closes #8970
Closes #9332.
PiperOrigin-RevId: 271343455
diff --git a/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java b/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
index 7e04b67..f5dbde2 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
@@ -59,28 +59,17 @@
public static final ExecutionOptions DEFAULTS = Options.getDefaults(ExecutionOptions.class);
@Option(
- name = "incompatible_list_based_execution_strategy_selection",
- defaultValue = "true",
- documentationCategory = OptionDocumentationCategory.EXECUTION_STRATEGY,
- effectTags = {OptionEffectTag.EXECUTION},
- metadataTags = {
- OptionMetadataTag.INCOMPATIBLE_CHANGE,
- OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES
- },
- help = "See https://github.com/bazelbuild/bazel/issues/7480")
- public boolean incompatibleListBasedExecutionStrategySelection;
-
- @Option(
name = "spawn_strategy",
defaultValue = "",
converter = CommaSeparatedNonEmptyOptionListConverter.class,
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
help =
- "Specify how spawn actions are executed by default. "
- + "'standalone' means run all of them locally without any kind of sandboxing. "
- + "'sandboxed' means to run them in a sandboxed environment with limited privileges "
- + "(details depend on platform support).")
+ "Specify how spawn actions are executed by default. Accepts a comma-separated list of"
+ + " strategies from highest to lowest priority. For each action Bazel picks the"
+ + " strategy with the highest priority that can execute the action. The default"
+ + " value is \"remote,worker,sandboxed,local\".See"
+ + " https://blog.bazel.build/2019/06/19/list-strategy.html for details.")
public List<String> spawnStrategy;
@Option(
@@ -103,9 +92,11 @@
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
help =
- "Specify how to distribute compilation of other spawn actions. "
- + "Example: 'Javac=local' means to spawn Java compilation locally. "
- + "'JavaIjar=sandboxed' means to spawn Java Ijar actions in a sandbox. ")
+ "Specify how to distribute compilation of other spawn actions. Accepts a comma-separated"
+ + " list of strategies from highest to lowest priority. For each action Bazel picks"
+ + " the strategy with the highest priority that can execute the action. The default"
+ + " value is \"remote,worker,sandboxed,local\".See"
+ + " https://blog.bazel.build/2019/06/19/list-strategy.html for details.")
public List<Map.Entry<String, List<String>>> strategy;
@Option(
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java
index 6412122..181b343 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java
@@ -125,7 +125,7 @@
String buildRequestId,
String commandId,
GrpcRemoteCache remoteCache,
- @Nullable GrpcRemoteExecutor remoteExecutor,
+ GrpcRemoteExecutor remoteExecutor,
@Nullable RemoteRetrier retrier,
DigestUtil digestUtil,
Path logDir,
@@ -135,7 +135,7 @@
this.executionOptions = executionOptions;
this.fallbackRunner = fallbackRunner;
this.remoteCache = Preconditions.checkNotNull(remoteCache, "remoteCache");
- this.remoteExecutor = remoteExecutor;
+ this.remoteExecutor = Preconditions.checkNotNull(remoteExecutor, "remoteExecutor");
this.verboseFailures = verboseFailures;
this.cmdlineReporter = cmdlineReporter;
this.buildRequestId = buildRequestId;
@@ -178,11 +178,8 @@
commandHash, merkleTree.getRootDigest(), context.getTimeout(), spawnCacheableRemotely);
ActionKey actionKey = digestUtil.computeActionKey(action);
- if (!Spawns.mayBeExecutedRemotely(spawn)) {
- return execLocallyAndUpload(
- spawn, context, inputMap, actionKey, action, command, uploadLocalResults);
- }
-
+ Preconditions.checkArgument(
+ Spawns.mayBeExecutedRemotely(spawn), "Spawn can't be executed remotely. This is a bug.");
// Look up action cache, and reuse the action output if it is found.
Context withMetadata =
TracingMetadataUtils.contextWithMetadata(buildRequestId, commandId, actionKey);
@@ -217,12 +214,6 @@
spawn, context, inputMap, actionKey, action, command, uploadLocalResults, e);
}
- if (remoteExecutor == null) {
- // Remote execution is disabled and so execute the spawn on the local machine.
- return execLocallyAndUpload(
- spawn, context, inputMap, actionKey, action, command, uploadLocalResults);
- }
-
ExecuteRequest.Builder requestBuilder =
ExecuteRequest.newBuilder()
.setInstanceName(remoteOptions.remoteInstanceName)