Skip to content

Commit

Permalink
[8.0.0] Cherry-pick two new logs to provide more information in dynam…
Browse files Browse the repository at this point in the history
…ic execution. (#24491)

RELNOTE: None
PiperOrigin-RevId: 700286030
Change-Id: I9c9f32f2d3e35b3cf6563a162d31ec35b8ea7e64

Commit
6f8f372

Co-authored-by: Googler <[email protected]>
  • Loading branch information
bazel-io and bigelephant29 authored Nov 27, 2024
1 parent 11596c3 commit ea0d27a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@
import com.google.devtools.build.lib.actions.Spawn;
import com.google.devtools.build.lib.actions.SpawnResult;
import com.google.devtools.build.lib.actions.SpawnResult.Status;
import com.google.devtools.build.lib.actions.SpawnStrategy;
import com.google.devtools.build.lib.dynamic.DynamicExecutionModule.IgnoreFailureCheck;
import com.google.devtools.build.lib.profiler.Profiler;
import com.google.devtools.build.lib.profiler.SilentCloseable;
import com.google.devtools.build.lib.util.io.FileOutErr;
import java.time.Duration;
import java.time.Instant;
import java.util.Optional;
import java.util.concurrent.Future;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
Expand Down Expand Up @@ -154,6 +153,17 @@ protected void prepareFuture(RemoteBranch remoteBranch) {
if (!future.isCancelled()) {
remoteBranch.cancel();
}
if (options.debugSpawnScheduler) {
logger.atInfo().log(
"In listener callback, the future of the local branch is %s",
future.state().name());
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
logger.atInfo().withCause(e).log(
"The future of the local branch failed with an exception.");
}
}
},
MoreExecutors.directExecutor());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
import com.google.devtools.build.lib.actions.SandboxedSpawnStrategy.StopConcurrentSpawns;
import com.google.devtools.build.lib.actions.Spawn;
import com.google.devtools.build.lib.actions.SpawnResult;
import com.google.devtools.build.lib.actions.SpawnStrategy;
import com.google.devtools.build.lib.dynamic.DynamicExecutionModule.IgnoreFailureCheck;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.util.io.FileOutErr;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -122,6 +122,17 @@ public void prepareFuture(LocalBranch localBranch) {
if (!future.isCancelled()) {
localBranch.cancel();
}
if (options.debugSpawnScheduler) {
logger.atInfo().log(
"In listener callback, the future of the remote branch is %s",
future.state().name());
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
logger.atInfo().withCause(e).log(
"The future of the remote branch failed with an exception.");
}
}
},
MoreExecutors.directExecutor());
}
Expand Down

0 comments on commit ea0d27a

Please sign in to comment.