@@ -59,54 +59,86 @@ private[ui] class AllStagesPage(parent: StagesTab) extends WebUIPage("") {
5959 val pools = sc.map(_.getAllPools).getOrElse(Seq .empty[Schedulable ])
6060 val poolTable = new PoolTable (pools, parent)
6161
62+ val shouldShowActiveStages = activeStages.nonEmpty
63+ val shouldShowPendingStages = pendingStages.nonEmpty
64+ val shouldShowCompletedStages = completedStages.nonEmpty
65+ val shouldShowFailedStages = failedStages.nonEmpty
66+
6267 val summary : NodeSeq =
6368 <div >
6469 <ul class =" unstyled" >
65- {if (sc.isDefined) {
66- // Total duration is not meaningful unless the UI is live
67- <li >
68- <strong >Total Duration : </strong >
69- {UIUtils .formatDuration(now - sc.get.startTime)}
70- </li >
71- }}
70+ {
71+ if (sc.isDefined) {
72+ // Total duration is not meaningful unless the UI is live
73+ <li >
74+ <strong >Total Duration : </strong >
75+ {UIUtils .formatDuration(now - sc.get.startTime)}
76+ </li >
77+ }
78+ }
7279 <li >
7380 <strong >Scheduling Mode : </strong >
7481 {listener.schedulingMode.map(_.toString).getOrElse(" Unknown" )}
7582 </li >
76- <li >
77- <a href =" #active" ><strong >Active Stages :</ strong></ a>
78- {activeStages.size}
79- </li >
80- <li >
81- <a href =" #pending" ><strong >Pending Stages :</ strong></ a>
82- {pendingStages.size}
83- </li >
84- <li >
85- <a href =" #completed" ><strong >Completed Stages :</ strong></ a>
86- {numCompletedStages}
87- </li >
88- <li >
89- <a href =" #failed" ><strong >Failed Stages :</ strong></ a>
90- {numFailedStages}
91- </li >
83+ {
84+ if (shouldShowActiveStages) {
85+ <li >
86+ <a href =" #active" ><strong >Active Stages :</ strong></ a>
87+ {activeStages.size}
88+ </li >
89+ }
90+ }
91+ {
92+ if (shouldShowPendingStages) {
93+ <li >
94+ <a href =" #pending" ><strong >Pending Stages :</ strong></ a>
95+ {pendingStages.size}
96+ </li >
97+ }
98+ }
99+ {
100+ if (shouldShowCompletedStages) {
101+ <li >
102+ <a href =" #completed" ><strong >Completed Stages :</ strong></ a>
103+ {numCompletedStages}
104+ </li >
105+ }
106+ }
107+ {
108+ if (shouldShowFailedStages) {
109+ <li >
110+ <a href =" #failed" ><strong >Failed Stages :</ strong></ a>
111+ {numFailedStages}
112+ </li >
113+ }
114+ }
92115 </ul >
93116 </div >
94117
95- val content = summary ++
96- {if (sc.isDefined && isFairScheduler) {
97- <h4 >{pools.size} Fair Scheduler Pools </h4 > ++ poolTable.toNodeSeq
98- } else {
99- Seq [Node ]()
100- }} ++
101- <h4 id =" active" >Active Stages ({activeStages.size})</h4 > ++
102- activeStagesTable.toNodeSeq ++
103- <h4 id =" pending" >Pending Stages ({pendingStages.size})</h4 > ++
104- pendingStagesTable.toNodeSeq ++
105- <h4 id =" completed" >Completed Stages ({numCompletedStages})</h4 > ++
106- completedStagesTable.toNodeSeq ++
107- <h4 id =" failed" >Failed Stages ({numFailedStages})</h4 > ++
118+ var content = summary ++
119+ {
120+ if (sc.isDefined && isFairScheduler) {
121+ <h4 >{pools.size} Fair Scheduler Pools </h4 > ++ poolTable.toNodeSeq
122+ } else {
123+ Seq [Node ]()
124+ }
125+ }
126+ if (shouldShowActiveStages) {
127+ content ++= <h4 id =" active" >Active Stages ({activeStages.size})</h4 > ++
128+ activeStagesTable.toNodeSeq
129+ }
130+ if (shouldShowPendingStages) {
131+ content ++= <h4 id =" pending" >Pending Stages ({pendingStages.size}</h4 > ++
132+ pendingStagesTable.toNodeSeq
133+ }
134+ if (shouldShowCompletedStages) {
135+ content ++= <h4 id =" completed" >Completed Stages ({numCompletedStages})</h4 > ++
136+ completedStagesTable.toNodeSeq
137+ }
138+ if (shouldShowFailedStages) {
139+ content ++= <h4 id =" failed" >Failed Stages ({numFailedStages})</h4 > ++
108140 failedStagesTable.toNodeSeq
109-
141+ }
110142 UIUtils .headerSparkPage(" Spark Stages (for all jobs)" , content, parent)
111143 }
112144 }
0 commit comments