From 521f1d6130261e84ba37d6c96f459f6219a3973d Mon Sep 17 00:00:00 2001 From: Josiah Samuel Date: Wed, 26 Aug 2015 07:08:46 -0400 Subject: [PATCH 1/2] [SPARK-10172][core]Fix for HistoryServer webUI mess up during sorting --- .../spark/deploy/history/HistoryPage.scala | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala b/core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala index 0830cc1ba1245..3e320742c4d6b 100644 --- a/core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala +++ b/core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala @@ -156,8 +156,7 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("") private def attemptRow( renderAttemptIdColumn: Boolean, info: ApplicationHistoryInfo, - attempt: ApplicationAttemptInfo, - isFirst: Boolean): Seq[Node] = { + attempt: ApplicationAttemptInfo): Seq[Node] = { val uiAddress = HistoryServer.getAttemptURI(info.id, attempt.attemptId) val startTime = UIUtils.formatDate(attempt.startTime) val endTime = if (attempt.endTime > 0) UIUtils.formatDate(attempt.endTime) else "-" @@ -169,21 +168,8 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("") } val lastUpdated = UIUtils.formatDate(attempt.lastUpdated) - { - if (isFirst) { - if (info.attempts.size > 1 || renderAttemptIdColumn) { - - {info.id} - - {info.name} - } else { - {info.id} - {info.name} - } - } else { - Nil - } - } + {info.id} + {info.name} { if (renderAttemptIdColumn) { if (info.attempts.size > 1 && attempt.attemptId.isDefined) { @@ -206,12 +192,11 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("") } private def appRow(info: ApplicationHistoryInfo): Seq[Node] = { - attemptRow(false, info, info.attempts.head, true) + attemptRow(false, info, info.attempts.head) } private def appWithAttemptRow(info: ApplicationHistoryInfo): Seq[Node] = { - attemptRow(true, info, info.attempts.head, true) ++ - info.attempts.drop(1).flatMap(attemptRow(true, info, _, false)) + info.attempts.flatMap(attemptRow(true, info, _)) } private def makePageLink(linkPage: Int, showIncomplete: Boolean): String = { From 1c59089f2bf04a6d4acae1cc7a05322077786e82 Mon Sep 17 00:00:00 2001 From: Josiah Samuel Date: Wed, 16 Sep 2015 05:36:57 -0400 Subject: [PATCH 2/2] [SPARK-10172][core]disable sort in HistoryServer webUI --- .../spark/deploy/history/HistoryPage.scala | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala b/core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala index 3e320742c4d6b..b347cb3be69f7 100644 --- a/core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala +++ b/core/src/main/scala/org/apache/spark/deploy/history/HistoryPage.scala @@ -51,7 +51,10 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("") val hasMultipleAttempts = appsToShow.exists(_.attempts.size > 1) val appTable = if (hasMultipleAttempts) { - UIUtils.listingTable(appWithAttemptHeader, appWithAttemptRow, appsToShow) + // Sorting is disable here as table sort on rowspan has issues. + // ref. SPARK-10172 + UIUtils.listingTable(appWithAttemptHeader, appWithAttemptRow, + appsToShow, sortable = false) } else { UIUtils.listingTable(appHeader, appRow, appsToShow) } @@ -156,7 +159,8 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("") private def attemptRow( renderAttemptIdColumn: Boolean, info: ApplicationHistoryInfo, - attempt: ApplicationAttemptInfo): Seq[Node] = { + attempt: ApplicationAttemptInfo, + isFirst: Boolean): Seq[Node] = { val uiAddress = HistoryServer.getAttemptURI(info.id, attempt.attemptId) val startTime = UIUtils.formatDate(attempt.startTime) val endTime = if (attempt.endTime > 0) UIUtils.formatDate(attempt.endTime) else "-" @@ -168,8 +172,21 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("") } val lastUpdated = UIUtils.formatDate(attempt.lastUpdated) - {info.id} - {info.name} + { + if (isFirst) { + if (info.attempts.size > 1 || renderAttemptIdColumn) { + + {info.id} + + {info.name} + } else { + {info.id} + {info.name} + } + } else { + Nil + } + } { if (renderAttemptIdColumn) { if (info.attempts.size > 1 && attempt.attemptId.isDefined) { @@ -192,11 +209,12 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("") } private def appRow(info: ApplicationHistoryInfo): Seq[Node] = { - attemptRow(false, info, info.attempts.head) + attemptRow(false, info, info.attempts.head, true) } private def appWithAttemptRow(info: ApplicationHistoryInfo): Seq[Node] = { - info.attempts.flatMap(attemptRow(true, info, _)) + attemptRow(true, info, info.attempts.head, true) ++ + info.attempts.drop(1).flatMap(attemptRow(true, info, _, false)) } private def makePageLink(linkPage: Int, showIncomplete: Boolean): String = {