Skip to content

Commit

Permalink
Rename "Analyzing" to "Scanning" in execution status event
Browse files Browse the repository at this point in the history
So it abbreviates more nicely.

RELNOTES: None.
PiperOrigin-RevId: 247385917
  • Loading branch information
hlopko authored and copybara-github committed May 9, 2019
1 parent 04bab36 commit 0320c5f
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*
* <p>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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
* <p>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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* <p>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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*
* <p>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.
*
* <p>If non-zero, implies that {@link #analyzing} is false.
* <p>If non-zero, implies that {@link #scanning} is false.
*/
int schedulingStrategiesBitmap = 0;

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

Expand All @@ -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;
Expand All @@ -222,14 +222,14 @@ synchronized int countActions() {
}

/**
* Marks the action as analyzing.
* Marks the action as scanning.
*
* <p>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;
}
}
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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";
}
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -724,7 +724,7 @@ Iterable<Artifact> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand All @@ -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"))
Expand Down

0 comments on commit 0320c5f

Please sign in to comment.