Skip to content

[SPARK-29596][Web UI] Task duration not updating for running tasks #27026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions core/src/main/scala/org/apache/spark/status/LiveEntity.scala
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,15 @@ private class LiveTask(
}

override protected def doUpdate(): Any = {
val duration = if (info.finished) {
info.duration
var duration: Long = 0
var executorRunTime: Long = 0

if (info.finished) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vars are not very cool in scala... how about something like this?

val (duration, executorRunTime) = if (info.finished) {
      (info.duration, metrics.executorRunTime)
    } else {
      val timeRunning = info.timeRunning(lastUpdateTime.getOrElse(System.currentTimeMillis()))
      (timeRunning, timeRunning)
    }

duration = info.duration
executorRunTime = metrics.executorRunTime
} else {
info.timeRunning(lastUpdateTime.getOrElse(System.currentTimeMillis()))
duration = info.timeRunning(lastUpdateTime.getOrElse(System.currentTimeMillis()))
executorRunTime = duration
}

new TaskDataWrapper(
Expand All @@ -198,7 +203,7 @@ private class LiveTask(

metrics.executorDeserializeTime,
metrics.executorDeserializeCpuTime,
metrics.executorRunTime,
executorRunTime,
metrics.executorCpuTime,
metrics.resultSize,
metrics.jvmGcTime,
Expand Down