Skip to content

Commit

Permalink
Remove SpawnStrategy#beginExecution().
Browse files Browse the repository at this point in the history
The corresponding method on TestStrategy and the like still remains (for the
time being)

RELNOTES: None.
PiperOrigin-RevId: 491304646
Change-Id: I263aa92af324ce17109163a5145cd32bb88c7486
  • Loading branch information
lberki authored and copybara-github committed Nov 28, 2022
1 parent a35d2a6 commit 0c52ef6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ public interface SpawnStrategy {
ImmutableList<SpawnResult> exec(Spawn spawn, ActionExecutionContext actionExecutionContext)
throws ExecException, InterruptedException;

/**
* Executes the given spawn, possibly asynchronously, and returns a SpawnContinuation to represent
* the execution. Otherwise all requirements from {@link #exec} apply.
*/
default SpawnContinuation beginExecution(
Spawn spawn, ActionExecutionContext actionExecutionContext) throws InterruptedException {
try {
return SpawnContinuation.immediate(exec(spawn, actionExecutionContext));
} catch (ExecException e) {
return SpawnContinuation.failedWithExecException(e);
}
}

/**
* Returns whether this SpawnActionContext supports executing the given Spawn. This does not allow
* using the legacy fallback to local execution controlled by the {@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.google.devtools.build.lib.actions.ActionExecutionContext;
import com.google.devtools.build.lib.actions.ExecException;
import com.google.devtools.build.lib.actions.Spawn;
import com.google.devtools.build.lib.actions.SpawnContinuation;
import com.google.devtools.build.lib.actions.SpawnResult;
import com.google.devtools.build.lib.actions.SpawnStrategy;
import com.google.devtools.build.lib.actions.UserExecException;
Expand All @@ -46,24 +45,6 @@ public ImmutableList<SpawnResult> exec(Spawn spawn, ActionExecutionContext actio
return resolveOne(spawn, actionExecutionContext).exec(spawn, actionExecutionContext);
}

/**
* Queues execution of the given spawn with the {@linkplain SpawnStrategyRegistry highest priority
* strategy} that can be found for it.
*
* @param actionExecutionContext context in which to execute the spawn
* @return handle to the spawn's pending execution (or failure thereof)
*/
public SpawnContinuation beginExecution(
Spawn spawn, ActionExecutionContext actionExecutionContext) throws InterruptedException {
SpawnStrategy resolvedStrategy;
try {
resolvedStrategy = resolveOne(spawn, actionExecutionContext);
} catch (ExecException e) {
return SpawnContinuation.failedWithExecException(e);
}
return resolvedStrategy.beginExecution(spawn, actionExecutionContext);
}

private SpawnStrategy resolveOne(Spawn spawn, ActionExecutionContext actionExecutionContext)
throws UserExecException {
List<? extends SpawnStrategy> strategies = resolve(spawn, actionExecutionContext);
Expand Down

0 comments on commit 0c52ef6

Please sign in to comment.