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

    https://github.com/apache/spark/pull/10815#discussion_r50054627
  
    --- Diff: core/src/main/scala/org/apache/spark/executor/TaskMetrics.scala 
---
    @@ -102,15 +102,38 @@ class TaskMetrics extends Serializable {
       private[spark] def incDiskBytesSpilled(value: Long): Unit = 
_diskBytesSpilled += value
       private[spark] def decDiskBytesSpilled(value: Long): Unit = 
_diskBytesSpilled -= value
     
    -  /**
    -   * If this task reads from a HadoopRDD or from persisted data, metrics 
on how much data was read
    -   * are stored here.
    -   */
       private var _inputMetrics: Option[InputMetrics] = None
     
    +  /**
    +   * Metrics related to reading data from a 
[[org.apache.spark.rdd.HadoopRDD]] or from persisted
    +   * data, defined only in tasks with input.
    +   */
       def inputMetrics: Option[InputMetrics] = _inputMetrics
     
       /**
    +   * Get or create a new [[InputMetrics]] associated with this task.
    +   */
    +  private[spark] def registerInputMetrics(readMethod: 
DataReadMethod.Value): InputMetrics = {
    +    synchronized {
    +      val metrics = _inputMetrics.getOrElse {
    +        val metrics = new InputMetrics(readMethod)
    +        _inputMetrics = Some(metrics)
    +        metrics
    +      }
    +      // If there already exists an InputMetric with the same read method, 
we can just return
    +      // that one. Otherwise, if the read method is different from the one 
previously seen by
    +      // this task, we return a new dummy one to avoid clobbering the 
values of the old metrics.
    +      // In the future we should try to store input metrics from all 
different read methods at
    +      // the same time (SPARK-5225).
    --- End diff --
    
    Hmm, that's unfortunate. Since it's a pre-existing problem, it's fine to 
not fix it here.


---
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