Github user mccheah commented on a diff in the pull request:
https://github.com/apache/spark/pull/21221#discussion_r206334329
--- Diff:
core/src/main/scala/org/apache/spark/status/AppStatusListener.scala ---
@@ -669,6 +686,34 @@ private[spark] class AppStatusListener(
}
}
}
+
+ // check if there is a new peak value for any of the executor level
memory metrics
+ // for the live UI. SparkListenerExecutorMetricsUpdate events are only
processed
+ // for the live UI.
+ event.executorUpdates.foreach { updates: ExecutorMetrics =>
+ liveExecutors.get(event.execId).foreach { exec: LiveExecutor =>
+ if (exec.peakExecutorMetrics.compareAndUpdatePeakValues(updates)) {
+ maybeUpdate(exec, now)
+ }
+ }
+ }
+ }
+
+ override def onStageExecutorMetrics(executorMetrics:
SparkListenerStageExecutorMetrics): Unit = {
+ val now = System.nanoTime()
+
+ // check if there is a new peak value for any of the executor level
memory metrics,
+ // while reading from the log. SparkListenerStageExecutorMetrics are
only processed
+ // when reading logs.
+ liveExecutors.get(executorMetrics.execId)
+ .orElse(deadExecutors.get(executorMetrics.execId)) match {
+ case Some(exec) =>
--- End diff --
Don't case compare with `Some` and `None` - for options prefer the
functional equivalents and occasionally can use isEmpty / isPresent. We can do
this here:
```
val opt = liveExecutors.get(...).orElse(...)
opt.foreach { ...}
if (opt.isEmpty) {
logWarning(...)
}
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]