Repository: spark
Updated Branches:
  refs/heads/master 5840f5464 -> 9d4449c4b


[SPARK-5228][WebUI] Hide tables for "Active Jobs/Completed Jobs/Failed Jobs" 
when they are empty

In current WebUI, tables for Active Stages, Completed Stages, Skipped Stages 
and Failed Stages are hidden when they are empty while tables for Active Jobs, 
Completed Jobs and Failed Jobs are not hidden though they are empty.

This is before my patch is applied.

![2015-01-13 14 13 
03](https://cloud.githubusercontent.com/assets/4736016/5730793/2b73d6f4-9b32-11e4-9a24-1784d758c644.png)

And this is after my patch is applied.

![2015-01-13 14 38 
13](https://cloud.githubusercontent.com/assets/4736016/5730797/359ea2da-9b32-11e4-97b0-544739ddbf4c.png)

Author: Kousuke Saruta <[email protected]>

Closes #4028 from sarutak/SPARK-5228 and squashes the following commits:

b1e6e8b [Kousuke Saruta] Fixed a small typo
daab563 [Kousuke Saruta] Merge branch 'master' of git://git.apache.org/spark 
into SPARK-5228
9493a1d [Kousuke Saruta] Modified AllJobPage.scala so that hide Active 
Jobs/Completed Jobs/Failed Jobs when they are empty


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/9d4449c4
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/9d4449c4
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/9d4449c4

Branch: refs/heads/master
Commit: 9d4449c4b3d0f5e60e71fef3a9b2e1c58a80b9e8
Parents: 5840f54
Author: Kousuke Saruta <[email protected]>
Authored: Wed Jan 14 11:10:29 2015 -0800
Committer: Josh Rosen <[email protected]>
Committed: Wed Jan 14 11:10:29 2015 -0800

----------------------------------------------------------------------
 .../org/apache/spark/ui/jobs/AllJobsPage.scala  | 62 ++++++++++++++------
 1 file changed, 43 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/9d4449c4/core/src/main/scala/org/apache/spark/ui/jobs/AllJobsPage.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/ui/jobs/AllJobsPage.scala 
b/core/src/main/scala/org/apache/spark/ui/jobs/AllJobsPage.scala
index ea2d187..1d1c701 100644
--- a/core/src/main/scala/org/apache/spark/ui/jobs/AllJobsPage.scala
+++ b/core/src/main/scala/org/apache/spark/ui/jobs/AllJobsPage.scala
@@ -47,7 +47,7 @@ private[ui] class AllJobsPage(parent: JobsTab) extends 
WebUIPage("") {
       val lastStageData = lastStageInfo.flatMap { s =>
         listener.stageIdToData.get((s.stageId, s.attemptId))
       }
-      val isComplete = job.status == JobExecutionStatus.SUCCEEDED
+
       val lastStageName = lastStageInfo.map(_.name).getOrElse("(Unknown Stage 
Name)")
       val lastStageDescription = 
lastStageData.flatMap(_.description).getOrElse("")
       val duration: Option[Long] = {
@@ -107,6 +107,10 @@ private[ui] class AllJobsPage(parent: JobsTab) extends 
WebUIPage("") {
       val failedJobsTable =
         jobsTable(failedJobs.sortBy(_.endTime.getOrElse(-1L)).reverse)
 
+      val shouldShowActiveJobs = activeJobs.nonEmpty
+      val shouldShowCompletedJobs = completedJobs.nonEmpty
+      val shouldShowFailedJobs = failedJobs.nonEmpty
+
       val summary: NodeSeq =
         <div>
           <ul class="unstyled">
@@ -121,27 +125,47 @@ private[ui] class AllJobsPage(parent: JobsTab) extends 
WebUIPage("") {
               <strong>Scheduling Mode: </strong>
               {listener.schedulingMode.map(_.toString).getOrElse("Unknown")}
             </li>
-            <li>
-              <a href="#active"><strong>Active Jobs:</strong></a>
-              {activeJobs.size}
-            </li>
-            <li>
-              <a href="#completed"><strong>Completed Jobs:</strong></a>
-              {completedJobs.size}
-            </li>
-            <li>
-              <a href="#failed"><strong>Failed Jobs:</strong></a>
-              {failedJobs.size}
-            </li>
+            {
+              if (shouldShowActiveJobs) {
+                <li>
+                  <a href="#active"><strong>Active Jobs:</strong></a>
+                  {activeJobs.size}
+                </li>
+              }
+            }
+            {
+              if (shouldShowCompletedJobs) {
+                <li>
+                  <a href="#completed"><strong>Completed Jobs:</strong></a>
+                  {completedJobs.size}
+                </li>
+              }
+            }
+            {
+              if (shouldShowFailedJobs) {
+                <li>
+                  <a href="#failed"><strong>Failed Jobs:</strong></a>
+                  {failedJobs.size}
+                </li>
+              }
+            }
           </ul>
         </div>
 
-      val content = summary ++
-        <h4 id="active">Active Jobs ({activeJobs.size})</h4> ++ 
activeJobsTable ++
-        <h4 id="completed">Completed Jobs ({completedJobs.size})</h4> ++ 
completedJobsTable ++
-        <h4 id ="failed">Failed Jobs ({failedJobs.size})</h4> ++ 
failedJobsTable
-
-      val helpText = """A job is triggered by a action, like "count()" or 
"saveAsTextFile()".""" +
+      var content = summary
+      if (shouldShowActiveJobs) {
+        content ++= <h4 id="active">Active Jobs ({activeJobs.size})</h4> ++
+          activeJobsTable
+      }
+      if (shouldShowCompletedJobs) {
+        content ++= <h4 id="completed">Completed Jobs 
({completedJobs.size})</h4> ++
+          completedJobsTable
+      }
+      if (shouldShowFailedJobs) {
+        content ++= <h4 id ="failed">Failed Jobs ({failedJobs.size})</h4> ++
+          failedJobsTable
+      }
+      val helpText = """A job is triggered by an action, like "count()" or 
"saveAsTextFile()".""" +
         " Click on a job's title to see information about the stages of tasks 
associated with" +
         " the job."
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to