Github user squito commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21221#discussion_r207004013
  
    --- 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) =>
    +         if 
(exec.peakExecutorMetrics.compareAndUpdatePeakValues(executorMetrics.executorMetrics))
 {
    +          maybeUpdate(exec, now)
    --- End diff --
    
    this is only for replaying from logs, right?  but then, `maybeUpdate` will 
be a no-op, as `live` is false.  So, what is the desired effect here?  But 
maybe I'm missing something, because this is covered by the some of the api 
tests.  I think maybe you don't need to call update at all here, and it'll just 
get written to the kvstore as part of the final `flush` call when the kvstore 
is closed after reading the whole log.
    
    also style nit: indentation is off


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to