Rename SpawnExecutionPolicy -> SpawnExecutionContext.
This class will be used to tie a Spawn to a SpawnRunner, and isn't really a policy object. It will carry state such as the expanded inputs and expanded command line.
Currently a context can be passed between different SpawnRunners. This will be addressed independently, so a context is tied to a particular spawn runner.
PiperOrigin-RevId: 193501918
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java
index 0cb40b1..72766ce 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java
@@ -26,7 +26,7 @@
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.Reporter;
import com.google.devtools.build.lib.exec.SpawnCache;
-import com.google.devtools.build.lib.exec.SpawnRunner.SpawnExecutionPolicy;
+import com.google.devtools.build.lib.exec.SpawnRunner.SpawnExecutionContext;
import com.google.devtools.build.lib.remote.TreeNodeRepository.TreeNode;
import com.google.devtools.build.lib.remote.util.DigestUtil;
import com.google.devtools.build.lib.remote.util.DigestUtil.ActionKey;
@@ -89,12 +89,12 @@
}
@Override
- public CacheHandle lookup(Spawn spawn, SpawnExecutionPolicy policy)
+ public CacheHandle lookup(Spawn spawn, SpawnExecutionContext context)
throws InterruptedException, IOException, ExecException {
// Temporary hack: the TreeNodeRepository should be created and maintained upstream!
TreeNodeRepository repository =
- new TreeNodeRepository(execRoot, policy.getActionInputFileCache(), digestUtil);
- SortedMap<PathFragment, ActionInput> inputMap = policy.getInputMapping();
+ new TreeNodeRepository(execRoot, context.getActionInputFileCache(), digestUtil);
+ SortedMap<PathFragment, ActionInput> inputMap = context.getInputMapping();
TreeNode inputRoot = repository.buildFromActionInputs(inputMap);
repository.computeMerkleDigests(inputRoot);
Command command = RemoteSpawnRunner.buildCommand(spawn.getArguments(), spawn.getEnvironment());
@@ -104,7 +104,7 @@
digestUtil.compute(command),
repository.getMerkleDigest(inputRoot),
spawn.getExecutionPlatform(),
- policy.getTimeout(),
+ context.getTimeout(),
Spawns.mayBeCached(spawn));
// Look up action cache, and reuse the action output if it is found.
@@ -123,7 +123,7 @@
// We don't cache failed actions, so we know the outputs exist.
// For now, download all outputs locally; in the future, we can reuse the digests to
// just update the TreeNodeRepository and continue the build.
- remoteCache.download(result, execRoot, policy.getFileOutErr());
+ remoteCache.download(result, execRoot, context.getFileOutErr());
SpawnResult spawnResult =
new SpawnResult.Builder()
.setStatus(Status.SUCCESS)
@@ -177,7 +177,7 @@
&& result.exitCode() == 0;
Context previous = withMetadata.attach();
try {
- remoteCache.upload(actionKey, execRoot, files, policy.getFileOutErr(), uploadAction);
+ remoteCache.upload(actionKey, execRoot, files, context.getFileOutErr(), uploadAction);
} catch (IOException e) {
if (verboseFailures) {
report(Event.debug("Upload to remote cache failed: " + e.getMessage()));
@@ -199,7 +199,7 @@
if (input instanceof VirtualActionInput) {
continue;
}
- Metadata metadata = policy.getActionInputFileCache().getMetadata(input);
+ Metadata metadata = context.getActionInputFileCache().getMetadata(input);
if (metadata instanceof FileArtifactValue) {
FileArtifactValue artifactValue = (FileArtifactValue) metadata;
Path path = execRoot.getRelative(input.getExecPath());