Skip to content

Commit ea8538c

Browse files
committed
Added cores column to executors page
1 parent e6a02c6 commit ea8538c

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

core/src/main/scala/org/apache/spark/status/api/v1/api.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class ExecutorSummary private[spark](
5757
val rddBlocks: Int,
5858
val memoryUsed: Long,
5959
val diskUsed: Long,
60+
val totalCores: Int,
6061
val maxTasks: Int,
6162
val activeTasks: Int,
6263
val failedTasks: Int,

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ private[ui] class ExecutorsPage(
7575
<th>RDD Blocks</th>
7676
<th><span data-toggle="tooltip" title={ToolTips.STORAGE_MEMORY}>Storage Memory</span></th>
7777
<th>Disk Used</th>
78+
<th>Cores</th>
7879
<th>Active Tasks</th>
7980
<th>Failed Tasks</th>
8081
<th>Complete Tasks</th>
@@ -131,6 +132,7 @@ private[ui] class ExecutorsPage(
131132
<td sorttable_customkey={diskUsed.toString}>
132133
{Utils.bytesToString(diskUsed)}
133134
</td>
135+
<td>{info.totalCores}</td>
134136
{taskData(info.maxTasks, info.activeTasks, info.failedTasks, info.completedTasks,
135137
info.totalTasks, info.totalDuration, info.totalGCTime)}
136138
<td sorttable_customkey={info.totalInputBytes.toString}>
@@ -174,6 +176,7 @@ private[ui] class ExecutorsPage(
174176
val maximumMemory = execInfo.map(_.maxMemory).sum
175177
val memoryUsed = execInfo.map(_.memoryUsed).sum
176178
val diskUsed = execInfo.map(_.diskUsed).sum
179+
val totalCores = execInfo.map(_.totalCores).sum
177180
val totalInputBytes = execInfo.map(_.totalInputBytes).sum
178181
val totalShuffleRead = execInfo.map(_.totalShuffleRead).sum
179182
val totalShuffleWrite = execInfo.map(_.totalShuffleWrite).sum
@@ -188,6 +191,7 @@ private[ui] class ExecutorsPage(
188191
<td sorttable_customkey={diskUsed.toString}>
189192
{Utils.bytesToString(diskUsed)}
190193
</td>
194+
<td>{totalCores}</td>
191195
{taskData(execInfo.map(_.maxTasks).sum,
192196
execInfo.map(_.activeTasks).sum,
193197
execInfo.map(_.failedTasks).sum,
@@ -211,6 +215,7 @@ private[ui] class ExecutorsPage(
211215
<th>RDD Blocks</th>
212216
<th><span data-toggle="tooltip" title={ToolTips.STORAGE_MEMORY}>Storage Memory</span></th>
213217
<th>Disk Used</th>
218+
<th>Cores</th>
214219
<th>Active Tasks</th>
215220
<th>Failed Tasks</th>
216221
<th>Complete Tasks</th>
@@ -305,6 +310,7 @@ private[spark] object ExecutorsPage {
305310
val memUsed = status.memUsed
306311
val maxMem = status.maxMem
307312
val diskUsed = status.diskUsed
313+
val totalCores = listener.executorToTotalCores.getOrElse(execId, 0)
308314
val maxTasks = listener.executorToTasksMax.getOrElse(execId, 0)
309315
val activeTasks = listener.executorToTasksActive.getOrElse(execId, 0)
310316
val failedTasks = listener.executorToTasksFailed.getOrElse(execId, 0)
@@ -323,6 +329,7 @@ private[spark] object ExecutorsPage {
323329
rddBlocks,
324330
memUsed,
325331
diskUsed,
332+
totalCores,
326333
maxTasks,
327334
activeTasks,
328335
failedTasks,

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ private[ui] class ExecutorsTab(parent: SparkUI) extends SparkUITab(parent, "exec
4545
@DeveloperApi
4646
class ExecutorsListener(storageStatusListener: StorageStatusListener, conf: SparkConf)
4747
extends SparkListener {
48+
val executorToTotalCores = HashMap[String, Int]()
4849
val executorToTasksMax = HashMap[String, Int]()
4950
val executorToTasksActive = HashMap[String, Int]()
5051
val executorToTasksComplete = HashMap[String, Int]()
@@ -65,8 +66,8 @@ class ExecutorsListener(storageStatusListener: StorageStatusListener, conf: Spar
6566
override def onExecutorAdded(executorAdded: SparkListenerExecutorAdded): Unit = synchronized {
6667
val eid = executorAdded.executorId
6768
executorToLogUrls(eid) = executorAdded.executorInfo.logUrlMap
68-
executorToTasksMax(eid) =
69-
executorAdded.executorInfo.totalCores / conf.getInt("spark.task.cpus", 1)
69+
executorToTotalCores(eid) = executorAdded.executorInfo.totalCores
70+
executorToTasksMax(eid) = executorToTotalCores(eid) / conf.getInt("spark.task.cpus", 1)
7071
executorIdToData(eid) = ExecutorUIData(executorAdded.time)
7172
}
7273

core/src/test/resources/HistoryServerExpectations/executor_list_json_expectation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"rddBlocks" : 8,
55
"memoryUsed" : 28000128,
66
"diskUsed" : 0,
7+
"totalCores" : 0,
78
"maxTasks" : 0,
89
"activeTasks" : 0,
910
"failedTasks" : 1,

0 commit comments

Comments
 (0)