aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala b/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala
index 791dbe5c27..67deb7b14b 100644
--- a/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala
+++ b/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala
@@ -20,6 +20,7 @@ package org.apache.spark.ui.exec
import java.net.URLEncoder
import javax.servlet.http.HttpServletRequest
+import scala.util.Try
import scala.xml.Node
import org.apache.spark.status.api.v1.ExecutorSummary
@@ -53,6 +54,9 @@ private[ui] class ExecutorsPage(
// When GCTimePercent is edited change ToolTips.TASK_TIME to match
private val GCTimePercent = 0.1
+ // a safe String to Int for sorting ids (converts non-numeric Strings to -1)
+ private def idStrToInt(str: String) : Int = Try(str.toInt).getOrElse(-1)
+
def render(request: HttpServletRequest): Seq[Node] = {
val (activeExecutorInfo, deadExecutorInfo) = listener.synchronized {
// The follow codes should be protected by `listener` to make sure no executors will be
@@ -69,13 +73,14 @@ private[ui] class ExecutorsPage(
}
val execInfo = activeExecutorInfo ++ deadExecutorInfo
+ implicit val idOrder = Ordering[Int].on((s: String) => idStrToInt(s)).reverse
val execInfoSorted = execInfo.sortBy(_.id)
val logsExist = execInfo.filter(_.executorLogs.nonEmpty).nonEmpty
val execTable = {
<table class={UIUtils.TABLE_CLASS_STRIPED_SORTABLE}>
<thead>
- <th>Executor ID</th>
+ <th class="sorttable_numeric">Executor ID</th>
<th>Address</th>
<th>Status</th>
<th>RDD Blocks</th>
@@ -136,7 +141,7 @@ private[ui] class ExecutorsPage(
}
<tr>
- <td>{info.id}</td>
+ <td sorttable_customkey={idStrToInt(info.id).toString}>{info.id}</td>
<td>{info.hostPort}</td>
<td sorttable_customkey={executorStatus.toString}>
{executorStatus}