diff options
author | Nathan Harmata <nharmata@google.com> | 2015-12-09 23:36:22 +0000 |
---|---|---|
committer | Lukacs Berki <lberki@google.com> | 2015-12-10 12:39:01 +0000 |
commit | 977316812543c64725beefc4d1f1c74cb1a870c0 (patch) | |
tree | 726a885b197c7c275bf00eae139dee6af6716feb /src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java | |
parent | 75ba9b938716a857a601f920bde87e5ee4413645 (diff) |
Repurpose the not-meaningfully-used ErrorInfo#isTransient to mean "is transitively transient". Some followup changes will use this method.
Previously, ErrorInfo#isTransient was only used internally in ParallelEvaluator; I think this method was originally added to ErrorInfo solely for the sake of convenience.
--
MOS_MIGRATED_REVID=109840031
Diffstat (limited to 'src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java b/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java index e9c18b136b..bd4978b60f 100644 --- a/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java +++ b/src/main/java/com/google/devtools/build/skyframe/ParallelEvaluator.java @@ -352,12 +352,12 @@ public final class ParallelEvaluator implements Evaluator { * dependencies of this node <i>must</i> already have been registered, since this method may * register a dependence on the error transience node, which should always be the last dep. */ - private void setError(ErrorInfo errorInfo) { + private void setError(ErrorInfo errorInfo, boolean isDirectlyTransient) { Preconditions.checkState(value == null, "%s %s %s", skyKey, value, errorInfo); Preconditions.checkState(this.errorInfo == null, "%s %s %s", skyKey, this.errorInfo, errorInfo); - if (errorInfo.isTransient()) { + if (isDirectlyTransient) { DependencyState triState = graph.get(ErrorTransienceValue.KEY).addReverseDepAndCheckIfDone(skyKey); Preconditions.checkState(triState == DependencyState.DONE, @@ -948,9 +948,22 @@ public final class ParallelEvaluator implements Evaluator { } } - registerNewlyDiscoveredDepsForDoneEntry(skyKey, state, env); - ErrorInfo errorInfo = ErrorInfo.fromException(reifiedBuilderException); - env.setError(errorInfo); + Map<SkyKey, NodeEntry> newlyRequestedDeps = graph.getBatch(env.newlyRequestedDeps); + boolean isTransitivelyTransient = reifiedBuilderException.isTransient(); + for (NodeEntry depEntry + : Iterables.concat(env.directDeps.values(), newlyRequestedDeps.values())) { + if (!isDoneForBuild(depEntry)) { + continue; + } + ErrorInfo depError = depEntry.getErrorInfo(); + if (depError != null) { + isTransitivelyTransient |= depError.isTransient(); + } + } + ErrorInfo errorInfo = ErrorInfo.fromException(reifiedBuilderException, + isTransitivelyTransient); + registerNewlyDiscoveredDepsForDoneEntry(skyKey, state, newlyRequestedDeps, env); + env.setError(errorInfo, /*isDirectlyTransient=*/ reifiedBuilderException.isTransient()); env.commit(/*enqueueParents=*/keepGoing); if (!shouldFailFast) { return; @@ -987,7 +1000,8 @@ public final class ParallelEvaluator implements Evaluator { Preconditions.checkState(!env.valuesMissing(), "%s -> %s, ValueEntry: %s", skyKey, newDirectDeps, state); env.setValue(value); - registerNewlyDiscoveredDepsForDoneEntry(skyKey, state, env); + registerNewlyDiscoveredDepsForDoneEntry(skyKey, state, + graph.getBatch(env.newlyRequestedDeps), env); env.commit(/*enqueueParents=*/true); return; } @@ -1128,11 +1142,11 @@ public final class ParallelEvaluator implements Evaluator { * enforce that condition. */ private void registerNewlyDiscoveredDepsForDoneEntry( - SkyKey skyKey, NodeEntry entry, SkyFunctionEnvironment env) { + SkyKey skyKey, NodeEntry entry, Map<SkyKey, NodeEntry> newlyRequestedDepMap, + SkyFunctionEnvironment env) { Set<SkyKey> unfinishedDeps = new HashSet<>(); - Map<SkyKey, NodeEntry> batch = graph.getBatch(env.newlyRequestedDeps); - for (SkyKey dep : env.newlyRequestedDeps) { - if (!isDoneForBuild(batch.get(dep))) { + for (SkyKey dep : env.newlyRequestedDeps) { + if (!isDoneForBuild(newlyRequestedDepMap.get(dep))) { unfinishedDeps.add(dep); } } @@ -1142,7 +1156,7 @@ public final class ParallelEvaluator implements Evaluator { // Note that this depEntry can't be null. If env.newlyRequestedDeps contained a key with a // null entry, then it would have been added to unfinishedDeps and then removed from // env.newlyRequestedDeps just above this loop. - NodeEntry depEntry = Preconditions.checkNotNull(batch.get(newDep), newDep); + NodeEntry depEntry = Preconditions.checkNotNull(newlyRequestedDepMap.get(newDep), newDep); DependencyState triState = depEntry.addReverseDepAndCheckIfDone(skyKey); Preconditions.checkState(DependencyState.DONE == triState, "new dep %s was not already done for %s. ValueEntry: %s. DepValueEntry: %s", @@ -1457,7 +1471,8 @@ public final class ParallelEvaluator implements Evaluator { ReifiedSkyFunctionException reifiedBuilderException = new ReifiedSkyFunctionException(builderException, parent); if (reifiedBuilderException.getRootCauseSkyKey().equals(parent)) { - error = ErrorInfo.fromException(reifiedBuilderException); + error = ErrorInfo.fromException(reifiedBuilderException, + /*isTransitivelyTransient=*/ false); bubbleErrorInfo.put(errorKey, ValueWithMetadata.error(ErrorInfo.fromChildErrors(errorKey, ImmutableSet.of(error)), env.buildEvents(/*missingChildren=*/true))); @@ -1638,7 +1653,7 @@ public final class ParallelEvaluator implements Evaluator { "Value %s was not successfully evaluated, but had no child errors. ValueEntry: %s", key, entry); SkyFunctionEnvironment env = new SkyFunctionEnvironment(key, directDeps, visitor); - env.setError(ErrorInfo.fromChildErrors(key, errorDeps)); + env.setError(ErrorInfo.fromChildErrors(key, errorDeps), /*isDirectlyTransient=*/false); env.commit(/*enqueueParents=*/false); } else { entry = graph.get(key); @@ -1689,7 +1704,7 @@ public final class ParallelEvaluator implements Evaluator { CycleInfo cycleInfo = new CycleInfo(cycle); // Add in this cycle. allErrors.add(ErrorInfo.fromCycle(cycleInfo)); - env.setError(ErrorInfo.fromChildErrors(key, allErrors)); + env.setError(ErrorInfo.fromChildErrors(key, allErrors), /*isTransient=*/false); env.commit(/*enqueueParents=*/false); continue; } else { |