wypoon commented on a change in pull request #23767: [SPARK-26329][CORE][WIP]
Faster polling of executor memory metrics.
URL: https://github.com/apache/spark/pull/23767#discussion_r263970746
##########
File path: core/src/main/scala/org/apache/spark/executor/Executor.scala
##########
@@ -553,9 +643,30 @@ private[spark] class Executor(
}
}
+ def decrementCount(stage: StageKey, count: AtomicLong): AtomicLong = {
+ val countValue = count.decrementAndGet()
+ if (countValue == 0L) {
+ logDebug(s"removing (${stage._1}, ${stage._2}) from activeStages")
+ null
+ } else {
+ logDebug(s"activeStages: (${stage._1}, ${stage._2}) -> " +
countValue)
+ count
+ }
+ }
+
+ // If the count is zero, the stage is removed from activeStages
+ activeStages.computeIfPresent((stageId, stageAttemptId),
decrementCount)
+
+ // If the stage has been removed from activeStages, remove it from
stageMetricPeaks too
+ def removeInactive(k: StageKey): Unit = {
+ if (activeStages.get(k) == null) {
+ stageMetricPeaks.remove(k)
+ }
+ }
+ stageMetricPeaks.forEachKey(LONG_MAX_VALUE, removeInactive)
Review comment:
I combined `activeStages` and `stageMetricPeaks` into a single
`ConcurrentHashMap` in the new `ExecutorMetricsPoller`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]