aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2018-04-05 23:21:04 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-05 23:22:48 -0700
commit24f19ec2679dd93b1ac5b06e46f3b35807d6e217 (patch)
treeea02ee80e8cd248f168b27db9a65efbbc39565be /src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
parentfdee70e6e39b74bfd9144b1e350d2d8806386e05 (diff)
Properly report completion of shared actions with input discovery
Currently we report "Analyzing" when include scanning runs. But since we can have shared C++ compile actions, only one of the group will be executed and only one will be reported completed. Remaining shared actions currently stay with "analyzing" forever. This cl makes sure that these actions are properly handled when finished. RELNOTES: None PiperOrigin-RevId: 191849728
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java18
1 files changed, 15 insertions, 3 deletions
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 49017083e6..18352ac52c 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
@@ -389,7 +389,8 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto
ActionMetadataHandler metadataHandler,
long actionStartTime,
ActionExecutionContext actionExecutionContext,
- ActionLookupData actionLookupData)
+ ActionLookupData actionLookupData,
+ boolean inputDiscoveryRan)
throws ActionExecutionException, InterruptedException {
Exception exception = badActionMap.get(action);
if (exception != null) {
@@ -409,8 +410,10 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto
// Check to see if another action is already executing/has executed this value.
Pair<ActionLookupData, FutureTask<ActionExecutionValue>> oldAction =
buildActionMap.putIfAbsent(primaryOutput, Pair.of(actionLookupData, actionTask));
+ // true if this is a non-shared action or it's shared and to be executed.
+ boolean isPrimaryActionForTheValue = oldAction == null;
- if (oldAction == null) {
+ if (isPrimaryActionForTheValue) {
actionTask.run();
} else {
// Wait for other action to finish, so any actions that depend on its outputs can execute.
@@ -423,6 +426,15 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto
ActionExecutionException.class, InterruptedException.class);
throw new IllegalStateException(e);
} finally {
+ if (!isPrimaryActionForTheValue && action.discoversInputs() && inputDiscoveryRan) {
+ /**
+ * If this is a shared action that does input discovery, but was not executed, we need to
+ * remove it from the active actions pool (it was added there by {@link
+ * ActionRunner#call()}).
+ */
+ // TODO(b/72764586): Cleanup once we can properly skip input discovery for shared actions
+ statusReporterRef.get().remove(action);
+ }
String message = action.getProgressMessage();
if (message != null) {
// Tell the receiver that the action has completed *before* telling the reporter.
@@ -832,7 +844,7 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto
context.getFileOutErr(),
outputDumped);
} finally {
- statusReporter.remove(action);
+ statusReporterRef.get().remove(action);
eventHandler.post(new ActionCompletionEvent(actionStartTime, action, actionLookupData));
}
}