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

    https://github.com/apache/spark/pull/18008#discussion_r116886967
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/jobs/UIData.scala ---
    @@ -112,9 +112,9 @@ private[spark] object UIData {
       /**
        * These are kept mutable and reused throughout a task's lifetime to 
avoid excessive reallocation.
        */
    -  class TaskUIData private(
    -      private var _taskInfo: TaskInfo,
    -      private var _metrics: Option[TaskMetricsUIData]) {
    +  class TaskUIData private(private var _taskInfo: TaskInfo) {
    +
    +    private[this] var _metrics: Option[TaskMetricsUIData] = 
Some(TaskMetricsUIData.EMPTY)
    --- End diff --
    
    The only way for this to become `None` is if `updateTaskMetrics` is called 
with `None`.
    
    `updateTaskMetrics` is called in two places:
    
    - In JobProgressListener.onTaskEnd, where the metrics are from 
`Option(taskEnd.taskMetrics)`, where `taskEnd.taskMetrics` can be `null` in 
case the task has failed (according to docs).
    - In JobProgressListener.onExecutorMetricsUpdate, where the metrics are 
guaranteed to be defined / non-None.


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