diff options
author | Chloe Calvarin <ccalvarin@google.com> | 2016-10-05 22:52:55 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2016-10-06 07:41:32 +0000 |
commit | 860b8d27724f6beeb67e19f102ddca00b143bee6 (patch) | |
tree | 139421c989295111ac452e159ec084f4a3397937 /src/main/java/com/google/devtools/build/skyframe/NodeEntryVisitor.java | |
parent | cddad444da9748f26b4326f8e2de13ad7f26239e (diff) |
EvaluationProgressReceiver absorbs other progress trackers.
Remove DirtyKeyTracker and inflight node tracking as independent
progress tracking bits of code, and instead use an internal-facing
DirtyTrackingProgressReceiver wrapper of the user's
EvaluationProgressReceiver.
--
MOS_MIGRATED_REVID=135291924
Diffstat (limited to 'src/main/java/com/google/devtools/build/skyframe/NodeEntryVisitor.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/skyframe/NodeEntryVisitor.java | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/src/main/java/com/google/devtools/build/skyframe/NodeEntryVisitor.java b/src/main/java/com/google/devtools/build/skyframe/NodeEntryVisitor.java index c4cb73045c..722410e77b 100644 --- a/src/main/java/com/google/devtools/build/skyframe/NodeEntryVisitor.java +++ b/src/main/java/com/google/devtools/build/skyframe/NodeEntryVisitor.java @@ -52,10 +52,8 @@ class NodeEntryVisitor { private final QuiescingExecutor quiescingExecutor; private final AtomicBoolean preventNewEvaluations = new AtomicBoolean(false); - private final Set<SkyKey> inflightNodes = Sets.newConcurrentHashSet(); private final Set<RuntimeException> crashes = Sets.newConcurrentHashSet(); - private final DirtyKeyTracker dirtyKeyTracker; - private final EvaluationProgressReceiver progressReceiver; + private final DirtyTrackingProgressReceiver progressReceiver; /** * Function that allows this visitor to execute the appropriate {@link Runnable} when given a * {@link SkyKey} to evaluate. @@ -64,22 +62,19 @@ class NodeEntryVisitor { NodeEntryVisitor( ForkJoinPool forkJoinPool, - DirtyKeyTracker dirtyKeyTracker, - EvaluationProgressReceiver progressReceiver, + DirtyTrackingProgressReceiver progressReceiver, Function<SkyKey, Runnable> runnableMaker) { this.quiescingExecutor = ForkJoinQuiescingExecutor.newBuilder() .withOwnershipOf(forkJoinPool) .setErrorClassifier(NODE_ENTRY_VISITOR_ERROR_CLASSIFIER) .build(); - this.dirtyKeyTracker = dirtyKeyTracker; this.progressReceiver = progressReceiver; this.runnableMaker = runnableMaker; } NodeEntryVisitor( int threadCount, - DirtyKeyTracker dirtyKeyTracker, - EvaluationProgressReceiver progressReceiver, + DirtyTrackingProgressReceiver progressReceiver, Function<SkyKey, Runnable> runnableMaker) { quiescingExecutor = new AbstractQueueVisitor( @@ -90,7 +85,6 @@ class NodeEntryVisitor { /*failFastOnException*/ true, "skyframe-evaluator", NODE_ENTRY_VISITOR_ERROR_CLASSIFIER); - this.dirtyKeyTracker = dirtyKeyTracker; this.progressReceiver = progressReceiver; this.runnableMaker = runnableMaker; } @@ -100,23 +94,13 @@ class NodeEntryVisitor { } void enqueueEvaluation(SkyKey key) { - // We unconditionally add the key to the set of in-flight nodes because even if evaluation is - // never scheduled we still want to remove the previously created NodeEntry from the graph. - // Otherwise we would leave the graph in a weird state (wasteful garbage in the best case and - // inconsistent in the worst case). - boolean newlyEnqueued = inflightNodes.add(key); - // All nodes enqueued for evaluation will be either verified clean, re-evaluated, or cleaned - // up after being in-flight when an error happens in nokeep_going mode or in the event of an - // interrupt. In any of these cases, they won't be dirty anymore. - if (newlyEnqueued) { - dirtyKeyTracker.notDirty(key); - } if (preventNewEvaluations.get()) { + // If an error happens in nokeep_going mode, we still want to mark these nodes as inflight, + // otherwise cleanup will not happen properly. + progressReceiver.enqueueAfterError(key); return; } - if (newlyEnqueued && progressReceiver != null) { - progressReceiver.enqueueing(key); - } + progressReceiver.enqueueing(key); quiescingExecutor.execute(runnableMaker.apply(key)); } @@ -137,18 +121,6 @@ class NodeEntryVisitor { return crashes; } - void notifyDone(SkyKey key) { - inflightNodes.remove(key); - } - - boolean isInflight(SkyKey key) { - return inflightNodes.contains(key); - } - - Set<SkyKey> getInflightNodes() { - return inflightNodes; - } - @VisibleForTesting CountDownLatch getExceptionLatchForTestingOnly() { return quiescingExecutor.getExceptionLatchForTestingOnly(); |