Skip to content

Commit 40b6cb7

Browse files
author
Marcelo Vanzin
committed
[SPARK-24414][ui] Calculate the correct number of tasks for a stage.
This change takes into account all non-pending tasks when calculating the number of tasks to be shown. This also means that when the stage is pending, the task table (or, in fact, most of the data in the stage page) will not be rendered. I also fixed the label when the known number of tasks is larger than the recorded number of tasks (it was inverted).
1 parent a53ea70 commit 40b6cb7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ private[ui] class StagePage(parent: StagesTab, store: AppStatusStore) extends We
117117

118118
val localitySummary = store.localitySummary(stageData.stageId, stageData.attemptId)
119119

120-
val totalTasks = stageData.numActiveTasks + stageData.numCompleteTasks +
121-
stageData.numFailedTasks + stageData.numKilledTasks
120+
val totalTasks = taskCount(stageData)
122121
if (totalTasks == 0) {
123122
val content =
124123
<div>
@@ -133,7 +132,7 @@ private[ui] class StagePage(parent: StagesTab, store: AppStatusStore) extends We
133132
val totalTasksNumStr = if (totalTasks == storedTasks) {
134133
s"$totalTasks"
135134
} else {
136-
s"$totalTasks, showing ${storedTasks}"
135+
s"$storedTasks, showing ${totalTasks}"
137136
}
138137

139138
val summary =
@@ -686,7 +685,7 @@ private[ui] class TaskDataSource(
686685

687686
private var _tasksToShow: Seq[TaskData] = null
688687

689-
override def dataSize: Int = stage.numTasks
688+
override def dataSize: Int = taskCount(stage)
690689

691690
override def sliceData(from: Int, to: Int): Seq[TaskData] = {
692691
if (_tasksToShow == null) {
@@ -1052,4 +1051,9 @@ private[ui] object ApiHelper {
10521051
(stage.map(_.name).getOrElse(""), stage.flatMap(_.description).getOrElse(job.name))
10531052
}
10541053

1054+
def taskCount(stageData: StageData): Int = {
1055+
stageData.numActiveTasks + stageData.numCompleteTasks + stageData.numFailedTasks +
1056+
stageData.numKilledTasks
1057+
}
1058+
10551059
}

0 commit comments

Comments
 (0)