You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by an...@apache.org on 2016/06/16 21:29:17 UTC
spark git commit: [SPARK-15868][WEB UI] Executors table in Executors
tab should sort Executor IDs in numerical order
Repository: spark
Updated Branches:
refs/heads/master 2d27eb1e7 -> e849285df
[SPARK-15868][WEB UI] Executors table in Executors tab should sort Executor IDs in numerical order
## What changes were proposed in this pull request?
Currently the Executors table sorts by id using a string sort (since that's what it is stored as). Since the id is a number (other than the driver) we should be sorting numerically. I have changed both the initial sort on page load as well as the table sort to sort on id numerically, treating non-numeric strings (like the driver) as "-1"
## How was this patch tested?
Manually tested and dev/run-tests


Author: Alex Bozarth <aj...@us.ibm.com>
Closes #13654 from ajbozarth/spark15868.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e849285d
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e849285d
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e849285d
Branch: refs/heads/master
Commit: e849285df03b1233d5f647f1b6c5a6dad0665855
Parents: 2d27eb1
Author: Alex Bozarth <aj...@us.ibm.com>
Authored: Thu Jun 16 14:29:11 2016 -0700
Committer: Andrew Or <an...@databricks.com>
Committed: Thu Jun 16 14:29:11 2016 -0700
----------------------------------------------------------------------
.../main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/e849285d/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala
----------------------------------------------------------------------
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 791dbe5..67deb7b 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}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org