From 0320c5f617d7f08796327eeb25c52ee155cfe472 Mon Sep 17 00:00:00 2001 From: hlopko Date: Thu, 9 May 2019 02:39:04 -0700 Subject: [PATCH] Rename "Analyzing" to "Scanning" in execution status event So it abbreviates more nicely. RELNOTES: None. PiperOrigin-RevId: 247385917 --- .../ActionExecutionStatusReporter.java | 4 +-- .../build/lib/actions/RunningActionEvent.java | 4 +-- ...ionEvent.java => ScanningActionEvent.java} | 4 +-- .../lib/actions/SchedulingActionEvent.java | 2 +- .../lib/runtime/ExperimentalEventHandler.java | 6 ++-- .../lib/runtime/ExperimentalStateTracker.java | 30 +++++++++---------- .../lib/skyframe/SkyframeActionExecutor.java | 4 +-- .../ActionExecutionStatusReporterTest.java | 4 +-- .../runtime/ExperimentalStateTrackerTest.java | 14 ++++----- 9 files changed, 36 insertions(+), 36 deletions(-) rename src/main/java/com/google/devtools/build/lib/actions/{AnalyzingActionEvent.java => ScanningActionEvent.java} (91%) diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionStatusReporter.java b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionStatusReporter.java index 294da65dc2c281..55a5e634793138 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionStatusReporter.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionStatusReporter.java @@ -120,9 +120,9 @@ public void updateStatus(ActionStartedEvent event) { @Subscribe @AllowConcurrentEvents - public void updateStatus(AnalyzingActionEvent event) { + public void updateStatus(ScanningActionEvent event) { ActionExecutionMetadata action = event.getActionMetadata(); - setStatus(action, "Analyzing"); + setStatus(action, "Scanning"); } @Subscribe diff --git a/src/main/java/com/google/devtools/build/lib/actions/RunningActionEvent.java b/src/main/java/com/google/devtools/build/lib/actions/RunningActionEvent.java index b88e6799f22ed8..aab8ca5fd7049f 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/RunningActionEvent.java +++ b/src/main/java/com/google/devtools/build/lib/actions/RunningActionEvent.java @@ -23,8 +23,8 @@ * *

This event should only appear in-between corresponding {@link ActionStartedEvent} and {@link * ActionCompletionEvent} events, and should only appear after corresponding {@link - * AnalyzingActionEvent} and {@link SchedulingActionEvent} events. TODO(jmmv): But this theory is - * not true today. Investigate. + * ScanningActionEvent} and {@link SchedulingActionEvent} events. TODO(jmmv): But this theory is not + * true today. Investigate. */ public class RunningActionEvent implements ProgressLike { diff --git a/src/main/java/com/google/devtools/build/lib/actions/AnalyzingActionEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ScanningActionEvent.java similarity index 91% rename from src/main/java/com/google/devtools/build/lib/actions/AnalyzingActionEvent.java rename to src/main/java/com/google/devtools/build/lib/actions/ScanningActionEvent.java index e1609df79c6952..99e60b3ab06482 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/AnalyzingActionEvent.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ScanningActionEvent.java @@ -22,12 +22,12 @@ *

This event should only appear in-between corresponding {@link ActionStartedEvent} and {@link * ActionCompletionEvent} events. TODO(jmmv): But this theory is not true today. Investigate. */ -public class AnalyzingActionEvent implements ProgressLike { +public class ScanningActionEvent implements ProgressLike { private final ActionExecutionMetadata action; /** Constructs a new event. */ - public AnalyzingActionEvent(ActionExecutionMetadata action) { + public ScanningActionEvent(ActionExecutionMetadata action) { this.action = action; } diff --git a/src/main/java/com/google/devtools/build/lib/actions/SchedulingActionEvent.java b/src/main/java/com/google/devtools/build/lib/actions/SchedulingActionEvent.java index 6d3ba4bbf0fd4d..3c04b007bf974c 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/SchedulingActionEvent.java +++ b/src/main/java/com/google/devtools/build/lib/actions/SchedulingActionEvent.java @@ -23,7 +23,7 @@ * *

This event should only appear in-between corresponding {@link ActionStartedEvent} and {@link * ActionCompletionEvent} events, and should only appear after a corresponding {@link - * AnalyzingActionEvent}. TODO(jmmv): But this theory is not true today. Investigate. + * ScanningActionEvent}. TODO(jmmv): But this theory is not true today. Investigate. */ public class SchedulingActionEvent implements ProgressLike { diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java index cd5f0688534315..1acd2adf46e441 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java @@ -21,8 +21,8 @@ import com.google.common.util.concurrent.Uninterruptibles; import com.google.devtools.build.lib.actions.ActionCompletionEvent; import com.google.devtools.build.lib.actions.ActionStartedEvent; -import com.google.devtools.build.lib.actions.AnalyzingActionEvent; import com.google.devtools.build.lib.actions.RunningActionEvent; +import com.google.devtools.build.lib.actions.ScanningActionEvent; import com.google.devtools.build.lib.actions.SchedulingActionEvent; import com.google.devtools.build.lib.analysis.AnalysisPhaseCompleteEvent; import com.google.devtools.build.lib.analysis.NoBuildEvent; @@ -768,8 +768,8 @@ public void actionStarted(ActionStartedEvent event) { @Subscribe @AllowConcurrentEvents - public void analyzingAction(AnalyzingActionEvent event) { - stateTracker.analyzingAction(event); + public void scanningAction(ScanningActionEvent event) { + stateTracker.scanningAction(event); refresh(); } diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java index 187eac524da312..e6fb22183a2ffe 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java @@ -24,9 +24,9 @@ import com.google.devtools.build.lib.actions.ActionCompletionEvent; import com.google.devtools.build.lib.actions.ActionExecutionMetadata; import com.google.devtools.build.lib.actions.ActionStartedEvent; -import com.google.devtools.build.lib.actions.AnalyzingActionEvent; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.RunningActionEvent; +import com.google.devtools.build.lib.actions.ScanningActionEvent; import com.google.devtools.build.lib.actions.SchedulingActionEvent; import com.google.devtools.build.lib.analysis.AnalysisPhaseCompleteEvent; import com.google.devtools.build.lib.analysis.ConfiguredTarget; @@ -177,25 +177,25 @@ private static class ActionState { long nanoStartTime; /** - * Whether this action is in the analyzing state or not. + * Whether this action is in the scanning state or not. * *

If true, implies that {@link #schedulingStrategiesBitmap} and {@link * #runningStrategiesBitmap} are both zero. The opposite is not necessarily true: if false, the * bitmaps can be zero as well to represent that the action is still in the preparation stage. */ - boolean analyzing; + boolean scanning; /** * Bitmap of strategies that are scheduling this action. * - *

If non-zero, implies that {@link #analyzing} is false. + *

If non-zero, implies that {@link #scanning} is false. */ int schedulingStrategiesBitmap = 0; /** * Bitmap of strategies that are running this action. * - *

If non-zero, implies that {@link #analyzing} is false. + *

If non-zero, implies that {@link #scanning} is false. */ int runningStrategiesBitmap = 0; @@ -208,7 +208,7 @@ private static class ActionState { /** Creates a deep copy of this action state. */ synchronized ActionState deepCopy() { ActionState other = new ActionState(action, nanoStartTime); - other.analyzing = analyzing; + other.scanning = scanning; other.schedulingStrategiesBitmap = schedulingStrategiesBitmap; other.runningStrategiesBitmap = runningStrategiesBitmap; return other; @@ -222,14 +222,14 @@ synchronized int countActions() { } /** - * Marks the action as analyzing. + * Marks the action as scanning. * *

Because we may receive events out of order, this does nothing if the action is already * scheduled or running. */ - void setAnalyzing(long nanoChangeTime) { + void setScanning(long nanoChangeTime) { if (schedulingStrategiesBitmap == 0 && runningStrategiesBitmap == 0) { - analyzing = true; + scanning = true; nanoStartTime = nanoChangeTime; } } @@ -243,7 +243,7 @@ void setAnalyzing(long nanoChangeTime) { void setScheduling(String strategy, long nanoChangeTime) { int id = strategyIds.getId(strategy); if ((runningStrategiesBitmap & id) == 0) { - analyzing = false; + scanning = false; schedulingStrategiesBitmap |= id; nanoStartTime = nanoChangeTime; } @@ -256,7 +256,7 @@ void setScheduling(String strategy, long nanoChangeTime) { * regardless of any other events (which may come out of order). */ void setRunning(String strategy, long nanoChangeTime) { - analyzing = false; + scanning = false; int id = strategyIds.getId(strategy); schedulingStrategiesBitmap &= ~id; runningStrategiesBitmap |= id; @@ -269,8 +269,8 @@ synchronized String describe() { return "Running"; } else if (schedulingStrategiesBitmap != 0) { return "Scheduling"; - } else if (analyzing) { - return "Analyzing"; + } else if (scanning) { + return "Scanning"; } else { return "Preparing"; } @@ -459,11 +459,11 @@ void actionStarted(ActionStartedEvent event) { } } - void analyzingAction(AnalyzingActionEvent event) { + void scanningAction(ScanningActionEvent event) { ActionExecutionMetadata action = event.getActionMetadata(); Artifact actionId = event.getActionMetadata().getPrimaryOutput(); long now = clock.nanoTime(); - getActionState(action, actionId, now).setAnalyzing(now); + getActionState(action, actionId, now).setScanning(now); } void schedulingAction(SchedulingActionEvent event) { diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java index 77b3511808ccb6..d5d6d03d733cab 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java @@ -48,7 +48,6 @@ import com.google.devtools.build.lib.actions.ActionStartedEvent; import com.google.devtools.build.lib.actions.Actions; import com.google.devtools.build.lib.actions.AlreadyReportedActionExecutionException; -import com.google.devtools.build.lib.actions.AnalyzingActionEvent; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.Artifact.ArtifactExpanderImpl; import com.google.devtools.build.lib.actions.Artifact.OwnerlessArtifactWrapper; @@ -69,6 +68,7 @@ import com.google.devtools.build.lib.actions.NotifyOnActionCacheHit; import com.google.devtools.build.lib.actions.NotifyOnActionCacheHit.ActionCachedContext; import com.google.devtools.build.lib.actions.PackageRootResolver; +import com.google.devtools.build.lib.actions.ScanningActionEvent; import com.google.devtools.build.lib.actions.TargetOutOfDateException; import com.google.devtools.build.lib.actions.cache.MetadataHandler; import com.google.devtools.build.lib.buildtool.BuildRequestOptions; @@ -724,7 +724,7 @@ Iterable discoverInputs( // streams is sufficient. setupActionFsFileOutErr(actionExecutionContext.getFileOutErr(), action); } - actionExecutionContext.getEventHandler().post(new AnalyzingActionEvent(action)); + actionExecutionContext.getEventHandler().post(new ScanningActionEvent(action)); try { return action.discoverInputs(actionExecutionContext); } catch (ActionExecutionException e) { diff --git a/src/test/java/com/google/devtools/build/lib/actions/ActionExecutionStatusReporterTest.java b/src/test/java/com/google/devtools/build/lib/actions/ActionExecutionStatusReporterTest.java index 84d7c664a0ff91..0bdf497aa0b172 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/ActionExecutionStatusReporterTest.java +++ b/src/test/java/com/google/devtools/build/lib/actions/ActionExecutionStatusReporterTest.java @@ -157,9 +157,9 @@ public void testDynamicUpdate() throws Exception { verifyOutput("Still waiting for 1 job to complete:", "Running (remote):", "action1, 1 s"); clock.advanceMillis(1000); - eventBus.post(new AnalyzingActionEvent(action)); + eventBus.post(new ScanningActionEvent(action)); // Locality strategy was changed, so timer was reset to 0 s. - verifyOutput("Still waiting for 1 job to complete:", "Analyzing:", "action1, 0 s"); + verifyOutput("Still waiting for 1 job to complete:", "Scanning:", "action1, 0 s"); statusReporter.remove(action); verifyNoOutput(); } diff --git a/src/test/java/com/google/devtools/build/lib/runtime/ExperimentalStateTrackerTest.java b/src/test/java/com/google/devtools/build/lib/runtime/ExperimentalStateTrackerTest.java index b768dd5adf4241..2e26c0642c4ef7 100644 --- a/src/test/java/com/google/devtools/build/lib/runtime/ExperimentalStateTrackerTest.java +++ b/src/test/java/com/google/devtools/build/lib/runtime/ExperimentalStateTrackerTest.java @@ -29,10 +29,10 @@ import com.google.devtools.build.lib.actions.ActionLookupData; import com.google.devtools.build.lib.actions.ActionOwner; import com.google.devtools.build.lib.actions.ActionStartedEvent; -import com.google.devtools.build.lib.actions.AnalyzingActionEvent; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.ArtifactRoot; import com.google.devtools.build.lib.actions.RunningActionEvent; +import com.google.devtools.build.lib.actions.ScanningActionEvent; import com.google.devtools.build.lib.actions.SchedulingActionEvent; import com.google.devtools.build.lib.analysis.ConfiguredTarget; import com.google.devtools.build.lib.bazel.repository.downloader.DownloadProgressEvent; @@ -742,15 +742,15 @@ public void testStatusShown() throws Exception { LoggingTerminalWriter terminalWriter; String output; - // Action foo being analyzed. + // Action foo being scanned. stateTracker.actionStarted(new ActionStartedEvent(actionFoo, 123456700)); - stateTracker.analyzingAction(new AnalyzingActionEvent(actionFoo)); + stateTracker.scanningAction(new ScanningActionEvent(actionFoo)); terminalWriter = new LoggingTerminalWriter(/*discardHighlight=*/ true); stateTracker.writeProgressBar(terminalWriter); output = terminalWriter.getTranscript(); - assertWithMessage("Action foo being analyzed should be visible in output:\n" + output) - .that(output.contains("ana") || output.contains("Ana")) + assertWithMessage("Action foo being scanned should be visible in output:\n" + output) + .that(output.contains("sca") || output.contains("Sca")) .isTrue(); // Then action bar gets scheduled. @@ -763,8 +763,8 @@ public void testStatusShown() throws Exception { assertWithMessage("Action bar being scheduled should be visible in output:\n" + output) .that(output.contains("sch") || output.contains("Sch")) .isTrue(); - assertWithMessage("Action foo being analyzed should still be visible in output:\n" + output) - .that(output.contains("ana") || output.contains("Ana")) + assertWithMessage("Action foo being scanned should still be visible in output:\n" + output) + .that(output.contains("sca") || output.contains("Sca")) .isTrue(); assertWithMessage("Indication at no actions are running is missing in output:\n" + output) .that(output.contains("0 running"))