Skip to content

Commit

Permalink
Add log line for locally-ignored signals.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 510529991
Change-Id: I78266eddd11870b2b300feac5c252d6c6a549566
  • Loading branch information
larsrc-google authored and copybara-github committed Feb 17, 2023
1 parent d683cca commit 669c298
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.common.flogger.GoogleLogger;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
import com.google.devtools.build.lib.actions.Spawn;
Expand Down Expand Up @@ -49,6 +50,7 @@

/** {@link BlazeModule} providing support for dynamic spawn execution and scheduling. */
public class DynamicExecutionModule extends BlazeModule {
private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();

private ExecutorService executorService;
Set<Integer> ignoreLocalSignals = ImmutableSet.of();
Expand Down Expand Up @@ -228,15 +230,17 @@ protected boolean canIgnoreFailure(
// More accurate information could be had through {@code waitid(2)}, but Java does not expose
// that. But accuracy is not critical here, at worst we are a bit slower in getting either
// a success or a failure.
if (isLocal && ignoreLocalSignals.contains(exitCode - 128)) {
int signal = exitCode - 128;
if (isLocal && ignoreLocalSignals.contains(signal)) {
if (verboseFailures) {
reporter.handle(
Event.info(
String.format(
"Local execution for %s stopped by signal %d, ignoring in favor of remote"
+ " execution.",
spawn.getResourceOwner().prettyPrint(), exitCode - 128)));
spawn.getResourceOwner().prettyPrint(), signal)));
}
logger.atInfo().log("Ignoring dynamic local branch killed by signal %d", signal);
return true;
}
return false;
Expand Down

0 comments on commit 669c298

Please sign in to comment.