Skip to content

Commit 4701f48

Browse files
mateizmarkhamstra
authored andcommitted
Merge pull request alteryx#181 from BlackNiuza/fix_tasks_number
correct number of tasks in ExecutorsUI Index `a` is not `execId` here (cherry picked from commit f568912) Signed-off-by: Reynold Xin <[email protected]>
1 parent 83c7f26 commit 4701f48

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

core/src/main/scala/org/apache/spark/ui/exec/ExecutorsUI.scala

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private[spark] class ExecutorsUI(val sc: SparkContext) {
7676
</tr>
7777
}
7878

79-
val execInfo = for (b <- 0 until storageStatusList.size) yield getExecInfo(b)
79+
val execInfo = for (statusId <- 0 until storageStatusList.size) yield getExecInfo(statusId)
8080
val execTable = UIUtils.listingTable(execHead, execRow, execInfo)
8181

8282
val content =
@@ -99,16 +99,17 @@ private[spark] class ExecutorsUI(val sc: SparkContext) {
9999
UIUtils.headerSparkPage(content, sc, "Executors (" + execInfo.size + ")", Executors)
100100
}
101101

102-
def getExecInfo(a: Int): Seq[String] = {
103-
val execId = sc.getExecutorStorageStatus(a).blockManagerId.executorId
104-
val hostPort = sc.getExecutorStorageStatus(a).blockManagerId.hostPort
105-
val rddBlocks = sc.getExecutorStorageStatus(a).blocks.size.toString
106-
val memUsed = sc.getExecutorStorageStatus(a).memUsed().toString
107-
val maxMem = sc.getExecutorStorageStatus(a).maxMem.toString
108-
val diskUsed = sc.getExecutorStorageStatus(a).diskUsed().toString
109-
val activeTasks = listener.executorToTasksActive.get(a.toString).map(l => l.size).getOrElse(0)
110-
val failedTasks = listener.executorToTasksFailed.getOrElse(a.toString, 0)
111-
val completedTasks = listener.executorToTasksComplete.getOrElse(a.toString, 0)
102+
def getExecInfo(statusId: Int): Seq[String] = {
103+
val status = sc.getExecutorStorageStatus(statusId)
104+
val execId = status.blockManagerId.executorId
105+
val hostPort = status.blockManagerId.hostPort
106+
val rddBlocks = status.blocks.size.toString
107+
val memUsed = status.memUsed().toString
108+
val maxMem = status.maxMem.toString
109+
val diskUsed = status.diskUsed().toString
110+
val activeTasks = listener.executorToTasksActive.getOrElse(execId, HashSet.empty[Long]).size
111+
val failedTasks = listener.executorToTasksFailed.getOrElse(execId, 0)
112+
val completedTasks = listener.executorToTasksComplete.getOrElse(execId, 0)
112113
val totalTasks = activeTasks + failedTasks + completedTasks
113114

114115
Seq(

0 commit comments

Comments
 (0)