Skip to content

Commit

Permalink
Stop prefetching inputs in RemoteSpawnCache.
Browse files Browse the repository at this point in the history
The various SpawnRunners already do it.

Also stop reporting a SpawnExecutingEvent. After the changes in d46aed6, this is no longer needed to ensure the UI tracker still reports "remote-cache" after other strategies transition to a later state.

PiperOrigin-RevId: 516797530
Change-Id: Ic7329ea510e5d070425c7910b2e1ae41da862f7e
  • Loading branch information
tjgq authored and fweikert committed May 25, 2023
1 parent c987e49 commit 0a74e53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.exec.SpawnCache;
import com.google.devtools.build.lib.exec.SpawnCheckingCacheEvent;
import com.google.devtools.build.lib.exec.SpawnExecutingEvent;
import com.google.devtools.build.lib.exec.SpawnRunner.SpawnExecutionContext;
import com.google.devtools.build.lib.profiler.Profiler;
import com.google.devtools.build.lib.profiler.ProfilerTask;
Expand All @@ -54,9 +53,6 @@ final class RemoteSpawnCache implements SpawnCache {
private static final SpawnCheckingCacheEvent SPAWN_CHECKING_CACHE_EVENT =
SpawnCheckingCacheEvent.create("remote-cache");

private static final SpawnExecutingEvent SPAWN_EXECUTING_EVENT =
SpawnExecutingEvent.create("remote-cache");

private final Path execRoot;
private final RemoteOptions options;
private final boolean verboseFailures;
Expand Down Expand Up @@ -150,10 +146,6 @@ public CacheHandle lookup(Spawn spawn, SpawnExecutionContext context)
}
}

context.prefetchInputsAndWait();

context.report(SPAWN_EXECUTING_EVENT);

if (shouldUploadLocalResults) {
return new CacheHandle() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import com.google.devtools.build.lib.events.StoredEventHandler;
import com.google.devtools.build.lib.exec.SpawnCache.CacheHandle;
import com.google.devtools.build.lib.exec.SpawnCheckingCacheEvent;
import com.google.devtools.build.lib.exec.SpawnExecutingEvent;
import com.google.devtools.build.lib.exec.SpawnInputExpander;
import com.google.devtools.build.lib.exec.SpawnRunner.ProgressStatus;
import com.google.devtools.build.lib.exec.SpawnRunner.SpawnExecutionContext;
Expand Down Expand Up @@ -352,10 +351,7 @@ public void cacheMiss() throws Exception {
doNothing().when(service).uploadOutputs(any(), any());
entry.store(result);
verify(service).uploadOutputs(any(), any());
assertThat(progressUpdates)
.containsExactly(
SpawnCheckingCacheEvent.create("remote-cache"),
SpawnExecutingEvent.create("remote-cache"));
assertThat(progressUpdates).containsExactly(SpawnCheckingCacheEvent.create("remote-cache"));
}

@Test
Expand Down Expand Up @@ -508,10 +504,7 @@ public void failedActionsAreNotUploaded() throws Exception {
.build();
entry.store(result);
verify(service, never()).uploadOutputs(any(), any());
assertThat(progressUpdates)
.containsExactly(
SpawnCheckingCacheEvent.create("remote-cache"),
SpawnExecutingEvent.create("remote-cache"));
assertThat(progressUpdates).containsExactly(SpawnCheckingCacheEvent.create("remote-cache"));
}

@Test
Expand Down Expand Up @@ -542,10 +535,7 @@ public void printWarningIfDownloadFails() throws Exception {
Event evt = eventHandler.getEvents().get(0);
assertThat(evt.getKind()).isEqualTo(EventKind.WARNING);
assertThat(evt.getMessage()).contains("UNAVAILABLE");
assertThat(progressUpdates)
.containsExactly(
SpawnCheckingCacheEvent.create("remote-cache"),
SpawnExecutingEvent.create("remote-cache"));
assertThat(progressUpdates).containsExactly(SpawnCheckingCacheEvent.create("remote-cache"));
}

@Test
Expand Down Expand Up @@ -589,10 +579,7 @@ public CachedActionResult answer(InvocationOnMock invocation) {
doNothing().when(service).uploadOutputs(any(), any());
entry.store(result);
verify(service).uploadOutputs(any(), eq(result));
assertThat(progressUpdates)
.containsExactly(
SpawnCheckingCacheEvent.create("remote-cache"),
SpawnExecutingEvent.create("remote-cache"));
assertThat(progressUpdates).containsExactly(SpawnCheckingCacheEvent.create("remote-cache"));
assertThat(eventHandler.getEvents()).isEmpty(); // no warning is printed.
}

Expand Down

0 comments on commit 0a74e53

Please sign in to comment.