Automated rollback of commit b77bf3c7f8d2872ce7ed33f063ccf1cfc1ab22aa.
*** Reason for rollback ***
Did not end up using to debug bug, avoid keeping complexity.
PiperOrigin-RevId: 320037162
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java
index d47fb64..c673a2b 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java
@@ -239,9 +239,11 @@
return pathResolver;
}
- /** Returns whether failures for {@code failedLabel} should have verbose error messages. */
- public boolean showVerboseFailures(Label failedLabel) {
- return executor.getVerboseFailuresPredicate().test(failedLabel);
+ /**
+ * Returns whether failures should have verbose error messages.
+ */
+ public boolean getVerboseFailures() {
+ return executor.getVerboseFailures();
}
/**
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ExecException.java b/src/main/java/com/google/devtools/build/lib/actions/ExecException.java
index 053ffe7..a44e925 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ExecException.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ExecException.java
@@ -94,8 +94,7 @@
* incorporating just the termination status if available.
*
* @param messagePrefix describes the action type as noun
- * @param verboseFailures true if user requested verbose output with flag --verbose_failures or
- * --experimental_verbose_failures_filter
+ * @param verboseFailures true if user requested verbose output with flag --verbose_failures
* @param action failed action
* @return ActionExecutionException object describing the action failure
*/
diff --git a/src/main/java/com/google/devtools/build/lib/actions/Executor.java b/src/main/java/com/google/devtools/build/lib/actions/Executor.java
index d72c4a4..269e26a 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/Executor.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/Executor.java
@@ -15,11 +15,9 @@
import com.google.devtools.build.lib.actions.ActionExecutionContext.ShowSubcommands;
import com.google.devtools.build.lib.clock.Clock;
-import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.vfs.FileSystem;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.common.options.OptionsProvider;
-import java.util.function.Predicate;
/**
* The Executor provides the context for the execution of actions. It is only valid during the
@@ -55,8 +53,10 @@
*/
Clock getClock();
- /** Predicate for whether an action's failures should have verbose error messages. */
- Predicate<Label> getVerboseFailuresPredicate();
+ /**
+ * Returns whether failures should have verbose error messages.
+ */
+ boolean getVerboseFailures();
/**
* Returns the command line options of the Blaze command being executed.
diff --git a/src/main/java/com/google/devtools/build/lib/actions/SpawnResult.java b/src/main/java/com/google/devtools/build/lib/actions/SpawnResult.java
index f345f71..9ddb878 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/SpawnResult.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/SpawnResult.java
@@ -374,7 +374,7 @@
TerminationStatus status = new TerminationStatus(
exitCode(), status() == Status.TIMEOUT);
String reason = " (" + status.toShortString() + ")"; // e.g " (Exit 1)"
- // Include the command line as error message if verbose_failures are enabled for this spawn or
+ // Include the command line as error message if --verbose_failures is enabled or
// the command line didn't exit normally.
String explanation = verboseFailures || !status.exited() ? ": " + message : "";
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/AbstractFileWriteAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/AbstractFileWriteAction.java
index fd4e550..5091db0 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/AbstractFileWriteAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/AbstractFileWriteAction.java
@@ -90,10 +90,9 @@
return this;
}
} catch (ExecException e) {
- Label label = getOwner().getLabel();
throw e.toActionExecutionException(
- "Writing file for rule '" + Label.print(label) + "'",
- actionExecutionContext.showVerboseFailures(label),
+ "Writing file for rule '" + Label.print(getOwner().getLabel()) + "'",
+ actionExecutionContext.getVerboseFailures(),
AbstractFileWriteAction.this);
}
afterWrite(actionExecutionContext);
@@ -101,10 +100,9 @@
}
};
} catch (ExecException e) {
- Label label = getOwner().getLabel();
throw e.toActionExecutionException(
- "Writing file for rule '" + Label.print(label) + "'",
- actionExecutionContext.showVerboseFailures(label),
+ "Writing file for rule '" + Label.print(getOwner().getLabel()) + "'",
+ actionExecutionContext.getVerboseFailures(),
this);
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
index ffb775f..f8e92ae 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
@@ -65,7 +65,6 @@
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.starlark.Args;
-import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.exec.SpawnStrategyResolver;
@@ -318,13 +317,12 @@
public final ActionContinuationOrResult beginExecution(
ActionExecutionContext actionExecutionContext)
throws ActionExecutionException, InterruptedException {
- Label label = getOwner().getLabel();
Spawn spawn;
try {
beforeExecute(actionExecutionContext);
spawn = getSpawn(actionExecutionContext);
} catch (ExecException e) {
- throw toActionExecutionException(e, actionExecutionContext.showVerboseFailures(label));
+ throw toActionExecutionException(e, actionExecutionContext.getVerboseFailures());
} catch (CommandLineExpansionException e) {
throw createDetailedException(e, Code.COMMAND_LINE_EXPANSION_FAILURE);
}
@@ -332,7 +330,7 @@
actionExecutionContext
.getContext(SpawnStrategyResolver.class)
.beginExecution(spawn, actionExecutionContext);
- return new SpawnActionContinuation(actionExecutionContext, spawnContinuation, label);
+ return new SpawnActionContinuation(actionExecutionContext, spawnContinuation);
}
private ActionExecutionException createDetailedException(Exception e, Code detailedCode) {
@@ -1380,15 +1378,11 @@
private final class SpawnActionContinuation extends ActionContinuationOrResult {
private final ActionExecutionContext actionExecutionContext;
private final SpawnContinuation spawnContinuation;
- private final Label label;
- SpawnActionContinuation(
- ActionExecutionContext actionExecutionContext,
- SpawnContinuation spawnContinuation,
- Label label) {
+ public SpawnActionContinuation(
+ ActionExecutionContext actionExecutionContext, SpawnContinuation spawnContinuation) {
this.actionExecutionContext = actionExecutionContext;
this.spawnContinuation = spawnContinuation;
- this.label = label;
}
@Override
@@ -1409,9 +1403,9 @@
afterExecute(actionExecutionContext, spawnResults);
return ActionContinuationOrResult.of(ActionResult.create(nextContinuation.get()));
}
- return new SpawnActionContinuation(actionExecutionContext, nextContinuation, label);
+ return new SpawnActionContinuation(actionExecutionContext, nextContinuation);
} catch (ExecException e) {
- throw toActionExecutionException(e, actionExecutionContext.showVerboseFailures(label));
+ throw toActionExecutionException(e, actionExecutionContext.getVerboseFailures());
}
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/TemplateExpansionAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/TemplateExpansionAction.java
index 6f61b29..9340b77 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/TemplateExpansionAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/TemplateExpansionAction.java
@@ -170,10 +170,9 @@
return this;
}
} catch (ExecException e) {
- Label label = getOwner().getLabel();
throw e.toActionExecutionException(
- "Error expanding template '" + Label.print(label) + "'",
- actionExecutionContext.showVerboseFailures(label),
+ "Error expanding template '" + Label.print(getOwner().getLabel()) + "'",
+ actionExecutionContext.getVerboseFailures(),
TemplateExpansionAction.this);
}
return ActionContinuationOrResult.of(ActionResult.create(nextContinuation.get()));
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/coverage/CoverageReportActionBuilder.java b/src/main/java/com/google/devtools/build/lib/bazel/coverage/CoverageReportActionBuilder.java
index 359975b..2c4110d 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/coverage/CoverageReportActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/coverage/CoverageReportActionBuilder.java
@@ -149,7 +149,7 @@
} catch (ExecException e) {
throw e.toActionExecutionException(
"Coverage report generation failed: ",
- actionExecutionContext.showVerboseFailures(getOwner().getLabel()),
+ actionExecutionContext.getVerboseFailures(),
this);
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/BuildResultPrinter.java b/src/main/java/com/google/devtools/build/lib/buildtool/BuildResultPrinter.java
index 715f1bd..d4a0e89 100644
--- a/src/main/java/com/google/devtools/build/lib/buildtool/BuildResultPrinter.java
+++ b/src/main/java/com/google/devtools/build/lib/buildtool/BuildResultPrinter.java
@@ -177,8 +177,7 @@
}
success = failed.isEmpty();
}
- if (!success && !request.getOptions(ExecutionOptions.class).hasSomeVerboseFailures()) {
- // TODO(janakr): Show better message if --experimental_verbose_failures_filter is on.
+ if (!success && !request.getOptions(ExecutionOptions.class).verboseFailures) {
outErr.printErr("Use --verbose_failures to see the command lines of failed build steps.\n");
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java
index 723f0fe..384ff69 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java
@@ -179,8 +179,7 @@
!Strings.isNullOrEmpty(resultMessage)
? resultMessage
: CommandFailureUtils.describeCommandFailure(
- actionExecutionContext.showVerboseFailures(
- spawn.getResourceOwner().getOwner().getLabel()),
+ actionExecutionContext.getVerboseFailures(),
spawn.getArguments(),
spawn.getEnvironment(),
cwd,
diff --git a/src/main/java/com/google/devtools/build/lib/exec/BUILD b/src/main/java/com/google/devtools/build/lib/exec/BUILD
index eabf79f..9e419e1 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/exec/BUILD
@@ -60,7 +60,6 @@
":spawn_strategy_registry",
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/clock",
- "//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/concurrent",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/vfs",
@@ -89,7 +88,6 @@
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/actions:localhost_capacity",
"//src/main/java/com/google/devtools/build/lib/analysis:config/per_label_options",
- "//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/util",
"//src/main/java/com/google/devtools/build/lib/util:resource_converter",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
diff --git a/src/main/java/com/google/devtools/build/lib/exec/BlazeExecutor.java b/src/main/java/com/google/devtools/build/lib/exec/BlazeExecutor.java
index 584cd77..96bba6f 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/BlazeExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/BlazeExecutor.java
@@ -17,13 +17,11 @@
import com.google.devtools.build.lib.actions.ActionExecutionContext.ShowSubcommands;
import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.clock.Clock;
-import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import com.google.devtools.build.lib.events.Reporter;
import com.google.devtools.build.lib.vfs.FileSystem;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.common.options.OptionsProvider;
-import java.util.function.Predicate;
import javax.annotation.Nullable;
/**
@@ -36,7 +34,8 @@
*/
@ThreadSafe
public final class BlazeExecutor implements Executor {
- private final Predicate<Label> verboseFailures;
+
+ private final boolean verboseFailures;
private final ShowSubcommands showSubcommands;
private final FileSystem fileSystem;
private final Path execRoot;
@@ -64,7 +63,7 @@
ModuleActionContextRegistry actionContextRegistry,
SpawnStrategyRegistry spawnStrategyRegistry) {
ExecutionOptions executionOptions = options.getOptions(ExecutionOptions.class);
- this.verboseFailures = executionOptions.getVerboseFailuresPredicate();
+ this.verboseFailures = executionOptions.verboseFailures;
this.showSubcommands = executionOptions.showSubcommands;
this.fileSystem = fileSystem;
this.execRoot = execRoot;
@@ -107,8 +106,9 @@
return actionContextRegistry.getContext(type);
}
+ /** Returns true iff the --verbose_failures option was enabled. */
@Override
- public Predicate<Label> getVerboseFailuresPredicate() {
+ public boolean getVerboseFailures() {
return verboseFailures;
}
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 28464e8..8b589bf 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
@@ -20,7 +20,6 @@
import com.google.devtools.build.lib.actions.LocalHostCapacity;
import com.google.devtools.build.lib.actions.ResourceSet;
import com.google.devtools.build.lib.analysis.config.PerLabelOptions;
-import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.util.OptionsUtils;
import com.google.devtools.build.lib.util.RegexFilter;
import com.google.devtools.build.lib.util.ResourceConverter;
@@ -39,7 +38,6 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import java.util.function.Predicate;
/**
* Options affecting the execution phase of a build.
@@ -128,9 +126,9 @@
documentationCategory = OptionDocumentationCategory.LOGGING,
effectTags = {OptionEffectTag.EXECUTION},
help =
- "Writes intermediate parameter files to output tree even when using remote action"
- + " execution. Useful when debugging actions. This is implied by --subcommands,"
- + " --verbose_failures, and --experimental_verbose_failures_filter.")
+ "Writes intermediate parameter files to output tree even when using "
+ + "remote action execution. Useful when debugging actions. "
+ + "This is implied by --subcommands and --verbose_failures.")
public boolean materializeParamFiles;
@Option(
@@ -142,13 +140,10 @@
public boolean materializeParamFilesDirectly;
public boolean shouldMaterializeParamFiles() {
- // Implied by --subcommands and verbose_failures
+ // Implied by --subcommands and --verbose_failures
return materializeParamFiles
|| showSubcommands != ActionExecutionContext.ShowSubcommands.FALSE
- // Conservatively materialize params files if any failures may be verbose.
- // TODO(janakr): Could try to thread action label through to here and only materialize for
- // those actions, but seems pretty gnarly.
- || hasSomeVerboseFailures();
+ || verboseFailures;
}
@Option(
@@ -156,33 +151,10 @@
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.LOGGING,
effectTags = {OptionEffectTag.TERMINAL_OUTPUT},
- help = "If any command fails, print out the full command line.")
+ help = "If a command fails, print out the full command line.")
public boolean verboseFailures;
@Option(
- name = "experimental_verbose_failures_filter",
- defaultValue = "null",
- converter = RegexFilter.RegexFilterConverter.class,
- documentationCategory = OptionDocumentationCategory.LOGGING,
- effectTags = {OptionEffectTag.TERMINAL_OUTPUT},
- help =
- "If a command fails, print out the full command line if its label matches the given"
- + " regex filter.")
- public RegexFilter verboseFailuresFilter;
-
- public boolean hasSomeVerboseFailures() {
- return verboseFailures || verboseFailuresFilter != null;
- }
-
- public Predicate<Label> getVerboseFailuresPredicate() {
- return verboseFailures
- ? l -> true
- : verboseFailuresFilter == null
- ? l -> false
- : l -> l == null || verboseFailuresFilter.isIncluded(l.getCanonicalForm());
- }
-
- @Option(
name = "subcommands",
abbrev = 's',
defaultValue = "false",
diff --git a/src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java
index 31a924f..1f8fd18 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java
@@ -124,9 +124,7 @@
}
} catch (ExecException e) {
throw e.toActionExecutionException(
- action.getProgressMessage(),
- actionExecutionContext.showVerboseFailures(action.getOwner().getLabel()),
- action);
+ action.getProgressMessage(), actionExecutionContext.getVerboseFailures(), action);
}
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/remote/BUILD b/src/main/java/com/google/devtools/build/lib/remote/BUILD
index 87c4505..6bf532e 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/remote/BUILD
@@ -51,7 +51,6 @@
"//src/main/java/com/google/devtools/build/lib/authandtls",
"//src/main/java/com/google/devtools/build/lib/bazel/repository/downloader",
"//src/main/java/com/google/devtools/build/lib/buildeventstream",
- "//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/collect",
"//src/main/java/com/google/devtools/build/lib/collect/nestedset",
"//src/main/java/com/google/devtools/build/lib/concurrent",
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteActionContextProvider.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteActionContextProvider.java
index 8b0f2e3..53aa101 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteActionContextProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteActionContextProvider.java
@@ -96,8 +96,7 @@
env.getExecRoot(),
checkNotNull(env.getOptions().getOptions(RemoteOptions.class)),
env.getOptions().getOptions(ExecutionOptions.class),
- checkNotNull(env.getOptions().getOptions(ExecutionOptions.class))
- .getVerboseFailuresPredicate(),
+ checkNotNull(env.getOptions().getOptions(ExecutionOptions.class)).verboseFailures,
env.getReporter(),
env.getBuildRequestId(),
env.getCommandId().toString(),
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 649e24a..3391b06 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
@@ -54,7 +54,6 @@
import com.google.devtools.build.lib.actions.Spawns;
import com.google.devtools.build.lib.actions.cache.VirtualActionInput;
import com.google.devtools.build.lib.analysis.platform.PlatformUtils;
-import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.Reporter;
@@ -103,7 +102,6 @@
import java.util.SortedMap;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.Predicate;
import java.util.function.Supplier;
import javax.annotation.Nullable;
@@ -147,7 +145,7 @@
private final Path execRoot;
private final RemoteOptions remoteOptions;
private final ExecutionOptions executionOptions;
- private final Predicate<Label> verboseFailures;
+ private final boolean verboseFailures;
@Nullable private final Reporter cmdlineReporter;
private final RemoteExecutionCache remoteCache;
@@ -171,7 +169,7 @@
Path execRoot,
RemoteOptions remoteOptions,
ExecutionOptions executionOptions,
- Predicate<Label> verboseFailures,
+ boolean verboseFailures,
@Nullable Reporter cmdlineReporter,
String buildRequestId,
String commandId,
@@ -341,8 +339,7 @@
spawnMetricsAccounting(spawnMetrics, actionResult.getExecutionMetadata());
try (SilentCloseable c = prof.profile(REMOTE_DOWNLOAD, "download server logs")) {
- maybeDownloadServerLogs(
- reply, actionKey, spawn.getResourceOwner().getOwner().getLabel());
+ maybeDownloadServerLogs(reply, actionKey);
}
try {
@@ -505,7 +502,7 @@
}
}
- private void maybeDownloadServerLogs(ExecuteResponse resp, ActionKey actionKey, Label label)
+ private void maybeDownloadServerLogs(ExecuteResponse resp, ActionKey actionKey)
throws InterruptedException {
ActionResult result = resp.getResult();
if (resp.getServerLogsCount() > 0
@@ -520,13 +517,11 @@
try {
getFromFuture(remoteCache.downloadFile(logPath, e.getValue().getDigest()));
} catch (IOException ex) {
- reportOnce(
- Event.warn(
- "Failed downloading server logs for " + label + " from the remote cache."));
+ reportOnce(Event.warn("Failed downloading server logs from the remote cache."));
}
}
}
- if (logCount > 0 && verboseFailures.test(label)) {
+ if (logCount > 0 && verboseFailures) {
report(
Event.info("Server logs of failing action:\n " + (logCount > 1 ? parent : logPath)));
}
@@ -565,20 +560,11 @@
return execLocallyAndUpload(
spawn, context, inputMap, actionKey, action, command, uploadLocalResults);
}
- return handleError(
- cause,
- context.getFileOutErr(),
- actionKey,
- context,
- spawn.getResourceOwner().getOwner().getLabel());
+ return handleError(cause, context.getFileOutErr(), actionKey, context);
}
private SpawnResult handleError(
- IOException exception,
- FileOutErr outErr,
- ActionKey actionKey,
- SpawnExecutionContext context,
- Label label)
+ IOException exception, FileOutErr outErr, ActionKey actionKey, SpawnExecutionContext context)
throws ExecException, InterruptedException, IOException {
boolean remoteCacheFailed = false;
if (exception instanceof BulkTransferException) {
@@ -589,7 +575,7 @@
ExecutionStatusException e = (ExecutionStatusException) exception.getCause();
if (e.getResponse() != null) {
ExecuteResponse resp = e.getResponse();
- maybeDownloadServerLogs(resp, actionKey, label);
+ maybeDownloadServerLogs(resp, actionKey);
if (resp.hasResult()) {
try {
// We try to download all (partial) results even on server error, for debuggability.
@@ -632,10 +618,10 @@
}
final String errorMessage;
- if (!verboseFailures.test(label)) {
+ if (!verboseFailures) {
errorMessage = Utils.grpcAwareErrorMessage(exception);
} else {
- // With verbose_failures print the whole stack trace
+ // On --verbose_failures print the whole stack trace
errorMessage = Throwables.getStackTraceAsString(exception);
}
@@ -758,7 +744,7 @@
remoteCache.upload(
actionKey, action, command, execRoot, outputFiles, context.getFileOutErr());
} catch (IOException e) {
- if (verboseFailures.test(spawn.getResourceOwner().getOwner().getLabel())) {
+ if (verboseFailures) {
report(Event.debug("Upload to remote cache failed: " + e.getMessage()));
} else {
reportOnce(Event.warn("Some artifacts failed be uploaded to the remote cache."));
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
index b908b35..d62da2b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
@@ -57,7 +57,6 @@
import com.google.devtools.build.lib.actions.extra.ExtraActionInfo;
import com.google.devtools.build.lib.analysis.starlark.Args;
import com.google.devtools.build.lib.bugreport.BugReport;
-import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.LabelConstants;
import com.google.devtools.build.lib.collect.CollectionUtils;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
@@ -438,10 +437,9 @@
throw new IllegalStateException(e.getCause());
}
} catch (ExecException e) {
- Label label = getOwner().getLabel();
throw e.toActionExecutionException(
- "Include scanning of rule '" + label + "'",
- actionExecutionContext.showVerboseFailures(label),
+ "Include scanning of rule '" + getOwner().getLabel() + "'",
+ actionExecutionContext.getVerboseFailures(),
this);
}
}
@@ -1831,10 +1829,9 @@
dotDContents = getDotDContents(spawnResults.get(0));
} catch (ExecException e) {
copyTempOutErrToActionOutErr();
- Label label = getOwner().getLabel();
throw e.toActionExecutionException(
- "C++ compilation of rule '" + label + "'",
- actionExecutionContext.showVerboseFailures(label),
+ "C++ compilation of rule '" + getOwner().getLabel() + "'",
+ actionExecutionContext.getVerboseFailures(),
CppCompileAction.this);
} catch (InterruptedException e) {
copyTempOutErrToActionOutErr();
@@ -1926,7 +1923,7 @@
e, createFailureDetail("OutErr copy failure", Code.COPY_OUT_ERR_FAILURE))
.toActionExecutionException(
getRawProgressMessage(),
- actionExecutionContext.showVerboseFailures(getOwner().getLabel()),
+ actionExecutionContext.getVerboseFailures(),
CppCompileAction.this);
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
index df38b54..8cec972 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
@@ -47,7 +47,6 @@
import com.google.devtools.build.lib.analysis.actions.ActionConstructionContext;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.starlark.Args;
-import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadCompatible;
@@ -473,10 +472,9 @@
}
return ActionContinuationOrResult.of(ActionResult.create(nextContinuation.get()));
} catch (ExecException e) {
- Label label = getOwner().getLabel();
throw e.toActionExecutionException(
- "Linking of rule '" + label + "'",
- actionExecutionContext.showVerboseFailures(label),
+ "Linking of rule '" + getOwner().getLabel() + "'",
+ actionExecutionContext.getVerboseFailures(),
CppLinkAction.this);
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
index 6703ef7..1bfb32f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
@@ -569,7 +569,7 @@
throw toActionExecutionException(
new EnvironmentalExecException(
e, createFailureDetail(".jdeps read IOException", Code.JDEPS_READ_IO_EXCEPTION)),
- actionExecutionContext.showVerboseFailures(getOwner().getLabel()));
+ actionExecutionContext.getVerboseFailures());
}
}
@@ -641,7 +641,7 @@
createFailureDetail(
"Failed to delete reduced action outputs",
Code.REDUCED_CLASSPATH_FALLBACK_CLEANUP_FAILURE)),
- actionExecutionContext.showVerboseFailures(getOwner().getLabel()));
+ actionExecutionContext.getVerboseFailures());
}
actionExecutionContext.getMetadataHandler().resetOutputs(getOutputs());
Spawn spawn;
@@ -660,8 +660,7 @@
return new JavaFallbackActionContinuation(
actionExecutionContext, results, fallbackContinuation);
} catch (ExecException e) {
- throw toActionExecutionException(
- e, actionExecutionContext.showVerboseFailures(getOwner().getLabel()));
+ throw toActionExecutionException(e, actionExecutionContext.getVerboseFailures());
}
}
}
@@ -705,8 +704,7 @@
ActionResult.create(
ImmutableList.copyOf(Iterables.concat(primaryResults, fallbackResults))));
} catch (ExecException e) {
- throw toActionExecutionException(
- e, actionExecutionContext.showVerboseFailures(getOwner().getLabel()));
+ throw toActionExecutionException(e, actionExecutionContext.getVerboseFailures());
}
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java
index 8807993..2719853 100644
--- a/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java
+++ b/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java
@@ -28,7 +28,6 @@
import com.google.devtools.build.lib.actions.SpawnResult.Status;
import com.google.devtools.build.lib.actions.Spawns;
import com.google.devtools.build.lib.actions.UserExecException;
-import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.exec.BinTools;
import com.google.devtools.build.lib.exec.ExecutionOptions;
import com.google.devtools.build.lib.exec.SpawnRunner;
@@ -52,7 +51,6 @@
import java.io.IOException;
import java.time.Duration;
import java.util.Map;
-import java.util.function.Predicate;
/** Abstract common ancestor for sandbox spawn runners implementing the common parts. */
abstract class AbstractSandboxSpawnRunner implements SpawnRunner {
@@ -62,7 +60,7 @@
"\n\nUse --sandbox_debug to see verbose messages from the sandbox";
private final SandboxOptions sandboxOptions;
- private final Predicate<Label> verboseFailures;
+ private final boolean verboseFailures;
private final ImmutableSet<Path> inaccessiblePaths;
protected final BinTools binTools;
private final Path execRoot;
@@ -70,8 +68,7 @@
public AbstractSandboxSpawnRunner(CommandEnvironment cmdEnv) {
this.sandboxOptions = cmdEnv.getOptions().getOptions(SandboxOptions.class);
- this.verboseFailures =
- cmdEnv.getOptions().getOptions(ExecutionOptions.class).getVerboseFailuresPredicate();
+ this.verboseFailures = cmdEnv.getOptions().getOptions(ExecutionOptions.class).verboseFailures;
this.inaccessiblePaths =
sandboxOptions.getInaccessiblePaths(cmdEnv.getRuntime().getFileSystem());
this.binTools = cmdEnv.getBlazeWorkspace().getBinTools();
@@ -154,7 +151,7 @@
null);
} else {
return CommandFailureUtils.describeCommandFailure(
- verboseFailures.test(originalSpawn.getResourceOwner().getOwner().getLabel()),
+ verboseFailures,
originalSpawn.getArguments(),
originalSpawn.getEnvironment(),
sandbox.getSandboxExecRoot().getPathString(),
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/BUILD b/src/main/java/com/google/devtools/build/lib/sandbox/BUILD
index ec77944..ba6b7be 100644
--- a/src/main/java/com/google/devtools/build/lib/sandbox/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/sandbox/BUILD
@@ -22,7 +22,6 @@
"//src/main/java/com/google/devtools/build/lib/analysis:blaze_directories",
"//src/main/java/com/google/devtools/build/lib/analysis:test/test_configuration",
"//src/main/java/com/google/devtools/build/lib/analysis/platform:platform_utils",
- "//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/exec:abstract_spawn_strategy",
"//src/main/java/com/google/devtools/build/lib/exec:bin_tools",
diff --git a/src/test/java/com/google/devtools/build/lib/actions/util/DummyExecutor.java b/src/test/java/com/google/devtools/build/lib/actions/util/DummyExecutor.java
index f0558f9..36f9a7a 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/util/DummyExecutor.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/util/DummyExecutor.java
@@ -18,11 +18,9 @@
import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.clock.BlazeClock;
import com.google.devtools.build.lib.clock.Clock;
-import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.vfs.FileSystem;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.common.options.OptionsProvider;
-import java.util.function.Predicate;
/** A dummy implementation of Executor. */
public class DummyExecutor implements Executor {
@@ -55,7 +53,7 @@
}
@Override
- public Predicate<Label> getVerboseFailuresPredicate() {
+ public boolean getVerboseFailures() {
throw new UnsupportedOperationException();
}
diff --git a/src/test/java/com/google/devtools/build/lib/remote/GrpcRemoteExecutionClientTest.java b/src/test/java/com/google/devtools/build/lib/remote/GrpcRemoteExecutionClientTest.java
index 8134e12..ef2e9c4 100644
--- a/src/test/java/com/google/devtools/build/lib/remote/GrpcRemoteExecutionClientTest.java
+++ b/src/test/java/com/google/devtools/build/lib/remote/GrpcRemoteExecutionClientTest.java
@@ -273,7 +273,7 @@
execRoot,
remoteOptions,
Options.getDefaults(ExecutionOptions.class),
- /* verboseFailures= */ l -> true,
+ /* verboseFailures= */ true,
/*cmdlineReporter=*/ null,
"build-req-id",
"command-id",
diff --git a/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerTest.java b/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerTest.java
index aac8abd..8dd55a4 100644
--- a/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/remote/RemoteSpawnRunnerTest.java
@@ -809,7 +809,7 @@
execRoot,
Options.getDefaults(RemoteOptions.class),
executionOptions,
- l -> true,
+ true,
/*cmdlineReporter=*/ null,
"build-req-id",
"command-id",
@@ -1026,18 +1026,25 @@
}
private RemoteSpawnRunner newSpawnRunner() {
- return newSpawnRunner(executor, /* reporter= */ null, /* topLevelOutputs= */ ImmutableSet.of());
+ return newSpawnRunner(
+ /* verboseFailures= */ false,
+ executor,
+ /* reporter= */ null,
+ /* topLevelOutputs= */ ImmutableSet.of());
}
private RemoteSpawnRunner newSpawnRunner(Reporter reporter) {
- return newSpawnRunner(executor, reporter, /* topLevelOutputs= */ ImmutableSet.of());
+ return newSpawnRunner(
+ /* verboseFailures= */ false, executor, reporter, /* topLevelOutputs= */ ImmutableSet.of());
}
private RemoteSpawnRunner newSpawnRunner(ImmutableSet<ActionInput> topLevelOutputs) {
- return newSpawnRunner(executor, /* reporter= */ null, topLevelOutputs);
+ return newSpawnRunner(
+ /* verboseFailures= */ false, executor, /* reporter= */ null, topLevelOutputs);
}
private RemoteSpawnRunner newSpawnRunner(
+ boolean verboseFailures,
@Nullable GrpcRemoteExecutor executor,
@Nullable Reporter reporter,
ImmutableSet<ActionInput> topLevelOutputs) {
@@ -1045,7 +1052,7 @@
execRoot,
remoteOptions,
Options.getDefaults(ExecutionOptions.class),
- l -> false,
+ verboseFailures,
reporter,
"build-req-id",
"command-id",