Skip to content

Commit

Permalink
Added a TOTALS row to the executors UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbozarth committed Jan 8, 2016
1 parent 9061e77 commit f0a725d
Showing 1 changed file with 46 additions and 10 deletions.
56 changes: 46 additions & 10 deletions core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,28 @@ private[ui] class ExecutorsPage(
val execInfoSorted = execInfo.sortBy(_.id)
val logsExist = execInfo.filter(_.executorLogs.nonEmpty).nonEmpty

val sumInfo = new ExecutorSummary(
"",
"",
execInfo.map(_.rddBlocks).sum,
execInfo.map(_.memoryUsed).sum,
execInfo.map(_.diskUsed).sum,
execInfo.map(_.activeTasks).sum,
execInfo.map(_.failedTasks).sum,
execInfo.map(_.completedTasks).sum,
execInfo.map(_.totalTasks).sum,
execInfo.map(_.totalDuration).sum,
execInfo.map(_.totalInputBytes).sum,
execInfo.map(_.totalShuffleRead).sum,
execInfo.map(_.totalShuffleWrite).sum,
execInfo.map(_.maxMemory).sum,
Map.empty
)

val execTable =
<table class={UIUtils.TABLE_CLASS_STRIPED_SORTABLE}>
<thead>
<th>Executor ID</th>
<th class="sorttable_alpha">Executor ID</th>
<th>Address</th>
<th>RDD Blocks</th>
<th><span data-toggle="tooltip" title={ToolTips.STORAGE_MEMORY}>Storage Memory</span></th>
Expand All @@ -88,6 +106,7 @@ private[ui] class ExecutorsPage(
{if (threadDumpEnabled) <th class="sorttable_nosort">Thread Dump</th> else Seq.empty}
</thead>
<tbody>
{execRow(sumInfo, logsExist)}
{execInfoSorted.map(execRow(_, logsExist))}
</tbody>
</table>
Expand All @@ -114,12 +133,23 @@ private[ui] class ExecutorsPage(

/** Render an HTML row representing an executor */
private def execRow(info: ExecutorSummary, logsExist: Boolean): Seq[Node] = {
val totalRow = info.id.isEmpty && info.hostPort.isEmpty;
val maximumMemory = info.maxMemory
val memoryUsed = info.memoryUsed
val diskUsed = info.diskUsed
<tr>
<td>{info.id}</td>
<td>{info.hostPort}</td>
{
if (totalRow)
<td sorttable_customkey="-1"></td>
else
<td>{info.id}</td>
}
{
if (totalRow)
<td sorttable_customkey="-1" style="font-weight: bold;">"TOTALS"</td>
else
<td>{info.hostPort}</td>
}
<td>{info.rddBlocks}</td>
<td sorttable_customkey={memoryUsed.toString}>
{Utils.bytesToString(memoryUsed)} /
Expand Down Expand Up @@ -148,12 +178,14 @@ private[ui] class ExecutorsPage(
if (logsExist) {
<td>
{
info.executorLogs.map { case (logName, logUrl) =>
<div>
<a href={logUrl}>
{logName}
</a>
</div>
if (!totalRow) {
info.executorLogs.map { case (logName, logUrl) =>
<div>
<a href={logUrl}>
{logName}
</a>
</div>
}
}
}
</td>
Expand All @@ -163,7 +195,11 @@ private[ui] class ExecutorsPage(
if (threadDumpEnabled) {
val encodedId = URLEncoder.encode(info.id, "UTF-8")
<td>
<a href={s"threadDump/?executorId=${encodedId}"}>Thread Dump</a>
{
if (!totalRow) {
<a href={s"threadDump/?executorId=${encodedId}"}>Thread Dump</a>
}
}
</td>
} else {
Seq.empty
Expand Down

0 comments on commit f0a725d

Please sign in to comment.