aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/remote
diff options
context:
space:
mode:
authorGravatar Ola Rozenfeld <olaola@google.com>2016-12-12 22:02:30 +0000
committerGravatar John Cater <jcater@google.com>2016-12-13 16:30:27 +0000
commit1c44aa656027fdb0013678d0242f5b8eb941a512 (patch)
tree8e22a57175540ea4e94de02152ea590c89fcc814 /src/main/java/com/google/devtools/build/lib/remote
parent4fb3a43192f4b7bc2e61f51dc4d39a0bb68daabd (diff)
Debugging flag (will rarely be used by actual users) that disables remote
execution cache. -- PiperOrigin-RevId: 141807596 MOS_MIGRATED_REVID=141807596
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/remote')
-rw-r--r--src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnStrategy.java11
2 files changed, 16 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java
index 6974aa5fcd..538c5544aa 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java
@@ -105,5 +105,13 @@ public final class RemoteOptions extends OptionsBase {
category = "remote",
help = "The maximal number of seconds to wait for remote calls. For client mode only."
)
- public int grpcTimeoutSeconds;
+ public int grpcTimeoutSeconds;
+
+ @Option(
+ name = "remote_accept_cached",
+ defaultValue = "true",
+ category = "remote",
+ help = "Whether to accept remotely cached action results."
+ )
+ public boolean remoteAcceptCached;
}
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnStrategy.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnStrategy.java
index 69508fa6d1..4dc998e7f8 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnStrategy.java
@@ -66,6 +66,7 @@ final class RemoteSpawnStrategy implements SpawnActionContext {
private final RemoteActionCache remoteActionCache;
private final RemoteWorkExecutor remoteWorkExecutor;
private final boolean verboseFailures;
+ private final boolean remoteAcceptCached;
RemoteSpawnStrategy(
Map<String, String> clientEnv,
@@ -80,6 +81,7 @@ final class RemoteSpawnStrategy implements SpawnActionContext {
this.verboseFailures = verboseFailures;
this.remoteActionCache = actionCache;
this.remoteWorkExecutor = workExecutor;
+ this.remoteAcceptCached = options.remoteAcceptCached;
}
private Action buildAction(
@@ -195,8 +197,9 @@ final class RemoteSpawnStrategy implements SpawnActionContext {
// Look up action cache, and reuse the action output if it is found.
actionKey = ContentDigests.computeActionKey(action);
- ActionResult result = remoteActionCache.getCachedActionResult(actionKey);
- boolean acceptCached = true;
+ ActionResult result = this.remoteAcceptCached
+ ? remoteActionCache.getCachedActionResult(actionKey) : null;
+ boolean acceptCachedResult = this.remoteAcceptCached;
if (result != null) {
// 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
@@ -205,7 +208,7 @@ final class RemoteSpawnStrategy implements SpawnActionContext {
remoteActionCache.downloadAllResults(result, execRoot);
return;
} catch (CacheNotFoundException e) {
- acceptCached = false; // Retry the action remotely and invalidate the results.
+ acceptCachedResult = false; // Retry the action remotely and invalidate the results.
}
}
@@ -222,7 +225,7 @@ final class RemoteSpawnStrategy implements SpawnActionContext {
ExecuteRequest.Builder request =
ExecuteRequest.newBuilder()
.setAction(action)
- .setAcceptCached(acceptCached)
+ .setAcceptCached(acceptCachedResult)
.setTotalInputFileCount(inputs.size())
.setTimeoutMillis(1000 * Spawns.getTimeoutSeconds(spawn, 120));
// TODO(olaola): set sensible local and remote timouts.