Skip to content

Commit

Permalink
Add logs to explain the state of a future after it's finished in dyna…
Browse files Browse the repository at this point in the history
…mic execution.

RELNOTE: None
PiperOrigin-RevId: 700286030
Change-Id: I9c9f32f2d3e35b3cf6563a162d31ec35b8ea7e64
  • Loading branch information
bigelephant29 authored and copybara-github committed Nov 26, 2024
1 parent ced7bfa commit 6f8f372
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 6f8f372

Please sign in to comment.