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

    https://github.com/apache/spark/pull/7753#discussion_r40026949
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/EventLoggingListener.scala ---
    @@ -152,8 +159,19 @@ private[spark] class EventLoggingListener(
         }
       }
     
    +  // We log the event both when stage submitted and stage completed, and 
after each logEvent call,
    +  // replace the modifiedMetrics with the latestMetrics. In case the 
stages submit and complete
    +  // time might be interleaved. So as to make the result the same with the 
running time.
    +  private def logMetricsUpdateEvent() : Unit = {
    +    modifiedMetrics.map(metrics => logEvent(metrics._2))
    +    latestMetrics.map(metrics => modifiedMetrics.update(metrics._1, 
metrics._2))
    +  }
    --- End diff --
    
    I'd rename this to `updateAndLogExecutorMemoryMetrics` or something like 
that, to be a little more specific.  I'd also change the first sentence of the 
comment to something like
    
    > When a stage is submitted and completed, we updated our executor memory 
metrics for that stage, and then log the metrics.  Anytime we receive more 
executor metrics, we update our running set of {{maxMetrics}} and 
{{latestMetrics}}.
    
    I don't understand the last two sentences of the comment -- can you expand 
on that?
    
    Finally you should use `foreach` and you can use `case` to extract the 
parts you want and make it a little clearer:
    
    ```scala
    modifiedMetrics.foreach { case (_, metrics) => logEvent(metrics) }
    latestMetrics.foreach { case (executorId, metrics) => 
modifiedMetrics.update(executorId, metrics) }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to