@@ -35,6 +35,7 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
35
35
Option (request.getParameter(" showIncomplete" )).getOrElse(" false" ).toBoolean
36
36
37
37
val allApps = parent.getApplicationList()
38
+ .filter(_.attempts.head.completed != requestedIncomplete)
38
39
val allAppsSize = allApps.size
39
40
40
41
val actualFirst = if (requestedFirst < allAppsSize) requestedFirst else 0
@@ -50,15 +51,9 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
50
51
val hasMultipleAttempts = appsToShow.exists(_.attempts.size > 1 )
51
52
val appTable =
52
53
if (hasMultipleAttempts) {
53
- UIUtils .listingTable(
54
- appWithAttemptHeader,
55
- appWithAttemptRow(_, requestedIncomplete),
56
- appsToShow)
54
+ UIUtils .listingTable(appWithAttemptHeader, appWithAttemptRow, appsToShow)
57
55
} else {
58
- UIUtils .listingTable(
59
- appHeader,
60
- appRow(_, requestedIncomplete),
61
- appsToShow)
56
+ UIUtils .listingTable(appHeader, appRow, appsToShow)
62
57
}
63
58
64
59
val providerConfig = parent.getProviderConfig()
@@ -69,61 +64,61 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
69
64
{providerConfig.map { case (k, v) => <li ><strong >{k}:</ strong> {v}</li > }}
70
65
</ul >
71
66
{
72
- // This displays the indices of pages that are within `plusOrMinus` pages of
73
- // the current page. Regardless of where the current page is, this also links
74
- // to the first and last page. If the current page +/- `plusOrMinus` is greater
75
- // than the 2nd page from the first page or less than the 2nd page from the last
76
- // page, `...` will be displayed.
77
- if (allAppsSize > 0 ) {
78
- val leftSideIndices =
79
- rangeIndices(actualPage - plusOrMinus until actualPage, 1 < _, requestedIncomplete)
80
- val rightSideIndices =
81
- rangeIndices(actualPage + 1 to actualPage + plusOrMinus, _ < pageCount,
82
- requestedIncomplete)
83
-
84
- <h4 >
85
- Showing {actualFirst + 1 }- {last + 1 } of {allAppsSize}
86
- {if (requestedIncomplete) " (Incomplete applications)" }
87
- <span style =" float: right" >
88
- {
89
- if (actualPage > 1 ) {
90
- <a href ={makePageLink(actualPage - 1 , requestedIncomplete)}>< </a >
91
- <a href ={makePageLink(1 , requestedIncomplete)}>1 </a >
92
- }
93
- }
94
- {if (actualPage - plusOrMinus > secondPageFromLeft) " ... " }
95
- {leftSideIndices}
96
- {actualPage}
97
- {rightSideIndices}
98
- {if (actualPage + plusOrMinus < secondPageFromRight) " ... " }
99
- {
100
- if (actualPage < pageCount) {
101
- <a href ={makePageLink(pageCount, requestedIncomplete)}>{pageCount}</a >
102
- <a href ={makePageLink(actualPage + 1 , requestedIncomplete)}> > </a >
103
- }
104
- }
105
- </span >
106
- </h4 > ++
67
+ // This displays the indices of pages that are within `plusOrMinus` pages of
68
+ // the current page. Regardless of where the current page is, this also links
69
+ // to the first and last page. If the current page +/- `plusOrMinus` is greater
70
+ // than the 2nd page from the first page or less than the 2nd page from the last
71
+ // page, `...` will be displayed.
72
+ if (allAppsSize > 0 ) {
73
+ val leftSideIndices =
74
+ rangeIndices(actualPage - plusOrMinus until actualPage, 1 < _, requestedIncomplete)
75
+ val rightSideIndices =
76
+ rangeIndices(actualPage + 1 to actualPage + plusOrMinus, _ < pageCount,
77
+ requestedIncomplete)
78
+
79
+ <h4 >
80
+ Showing {actualFirst + 1 }- {last + 1 } of {allAppsSize}
81
+ {if (requestedIncomplete) " (Incomplete applications)" }
82
+ <span style =" float: right" >
83
+ {
84
+ if (actualPage > 1 ) {
85
+ <a href ={makePageLink(actualPage - 1 , requestedIncomplete)}>< </a >
86
+ <a href ={makePageLink(1 , requestedIncomplete)}>1 </a >
87
+ }
88
+ }
89
+ {if (actualPage - plusOrMinus > secondPageFromLeft) " ... " }
90
+ {leftSideIndices}
91
+ {actualPage}
92
+ {rightSideIndices}
93
+ {if (actualPage + plusOrMinus < secondPageFromRight) " ... " }
94
+ {
95
+ if (actualPage < pageCount) {
96
+ <a href ={makePageLink(pageCount, requestedIncomplete)}>{pageCount}</a >
97
+ <a href ={makePageLink(actualPage + 1 , requestedIncomplete)}> > </a >
98
+ }
99
+ }
100
+ </span >
101
+ </h4 > ++
107
102
appTable
108
- } else if (requestedIncomplete) {
109
- <h4 >No incomplete applications found!</ h4>
110
- } else {
111
- <h4 >No completed applications found!</ h4> ++
103
+ } else if (requestedIncomplete) {
104
+ <h4 >No incomplete applications found!</ h4>
105
+ } else {
106
+ <h4 >No completed applications found!</ h4> ++
112
107
<p >Did you specify the correct logging directory?
113
108
Please verify your setting of <span style =" font-style:italic" >
114
109
spark.history.fs.logDirectory</span > and whether you have the permissions to
115
110
access it.<br /> It is also possible that your application did not run to
116
111
completion or did not stop the SparkContext .
117
112
</p >
118
- }
113
+ }
119
114
}
120
115
<a href ={makePageLink(actualPage, ! requestedIncomplete)}>
121
116
{
122
- if (requestedIncomplete) {
123
- " Back to completed applications"
124
- } else {
125
- " Show incomplete applications"
126
- }
117
+ if (requestedIncomplete) {
118
+ " Back to completed applications"
119
+ } else {
120
+ " Show incomplete applications"
121
+ }
127
122
}
128
123
</a >
129
124
</div >
@@ -151,19 +146,18 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
151
146
" Last Updated" )
152
147
153
148
private def rangeIndices (
154
- range : Seq [Int ],
155
- condition : Int => Boolean ,
156
- showIncomplete : Boolean ): Seq [Node ] = {
149
+ range : Seq [Int ],
150
+ condition : Int => Boolean ,
151
+ showIncomplete : Boolean ): Seq [Node ] = {
157
152
range.filter(condition).map(nextPage =>
158
153
<a href ={makePageLink(nextPage, showIncomplete)}> {nextPage} </a >)
159
154
}
160
155
161
156
private def attemptRow (
162
- renderAttemptIdColumn : Boolean ,
163
- info : ApplicationHistoryInfo ,
164
- attempt : ApplicationAttemptInfo ,
165
- isFirst : Boolean ,
166
- requestedIncomplete : Boolean ): Seq [Node ] = {
157
+ renderAttemptIdColumn : Boolean ,
158
+ info : ApplicationHistoryInfo ,
159
+ attempt : ApplicationAttemptInfo ,
160
+ isFirst : Boolean ): Seq [Node ] = {
167
161
val uiAddress = HistoryServer .getAttemptURI(info.id, attempt.attemptId)
168
162
val startTime = UIUtils .formatDate(attempt.startTime)
169
163
val endTime = if (attempt.endTime > 0 ) UIUtils .formatDate(attempt.endTime) else " -"
@@ -174,67 +168,50 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
174
168
" -"
175
169
}
176
170
val lastUpdated = UIUtils .formatDate(attempt.lastUpdated)
177
- var someAttemptCompleted = false
178
- info.attempts.foreach{ attempt =>
179
- if (attempt.completed) someAttemptCompleted = true
180
- }
181
171
<tr >
182
172
{
183
- if (isFirst) {
184
- if (info.attempts.size > 1 || renderAttemptIdColumn) {
185
- <td rowspan ={info.attempts.size.toString} style =" background-color: #ffffff" >
186
- <a href ={uiAddress}>{info.id}</a ></td >
173
+ if (isFirst) {
174
+ if (info.attempts.size > 1 || renderAttemptIdColumn) {
175
+ <td rowspan ={info.attempts.size.toString} style =" background-color: #ffffff" >
176
+ <a href ={uiAddress}>{info.id}</a ></td >
187
177
<td rowspan ={info.attempts.size.toString} style =" background-color: #ffffff" >
188
178
{info.name}</td >
189
- } else {
190
- <td ><a href ={uiAddress}>{info.id}</a ></td >
191
- <td >{info.name}</td >
192
- }
193
179
} else {
194
- Nil
180
+ <td ><a href ={uiAddress}>{info.id}</a ></td >
181
+ <td >{info.name}</td >
195
182
}
183
+ } else {
184
+ Nil
196
185
}
197
- {
198
- if (renderAttemptIdColumn &&
199
- (requestedIncomplete || (! requestedIncomplete && someAttemptCompleted))) {
200
- if (info.attempts.size > 1 && attempt.attemptId.isDefined) {
201
- <td ><a href ={HistoryServer .getAttemptURI(info.id, attempt.attemptId)}>
202
- {attempt.attemptId.get}</a ></td >
203
- } else {
204
- <td > </td >
205
- }
206
- } else {
207
- Nil
208
- }
209
186
}
210
187
{
211
- if (requestedIncomplete || (! requestedIncomplete && someAttemptCompleted)) {
212
- <td sorttable_customkey ={attempt.startTime.toString}>{startTime}</td >
213
- <td sorttable_customkey ={attempt.endTime.toString}>{endTime}</td >
214
- <td sorttable_customkey ={(attempt.endTime - attempt.startTime).toString}>
215
- {duration}</td >
216
- <td >{attempt.sparkUser}</td >
217
- <td sorttable_customkey ={attempt.lastUpdated.toString}>{lastUpdated}</td >
188
+ if (renderAttemptIdColumn) {
189
+ if (info.attempts.size > 1 && attempt.attemptId.isDefined) {
190
+ <td ><a href ={HistoryServer .getAttemptURI(info.id, attempt.attemptId)}>
191
+ {attempt.attemptId.get}</a ></td >
218
192
} else {
219
- Nil
193
+ < td > </ td >
220
194
}
195
+ } else {
196
+ Nil
197
+ }
221
198
}
199
+ <td sorttable_customkey ={attempt.startTime.toString}>{startTime}</td >
200
+ <td sorttable_customkey ={attempt.endTime.toString}>{endTime}</td >
201
+ <td sorttable_customkey ={(attempt.endTime - attempt.startTime).toString}>
202
+ {duration}</td >
203
+ <td >{attempt.sparkUser}</td >
204
+ <td sorttable_customkey ={attempt.lastUpdated.toString}>{lastUpdated}</td >
222
205
</tr >
223
206
}
224
207
225
-
226
-
227
- private def appRow (
228
- info : ApplicationHistoryInfo ,
229
- requestedIncomplete : Boolean ): Seq [Node ] = {
230
- attemptRow(false , info, info.attempts.head, true , requestedIncomplete)
208
+ private def appRow (info : ApplicationHistoryInfo ): Seq [Node ] = {
209
+ attemptRow(false , info, info.attempts.head, true )
231
210
}
232
211
233
- private def appWithAttemptRow (
234
- info : ApplicationHistoryInfo ,
235
- requestedIncomplete : Boolean ): Seq [Node ] = {
236
- attemptRow(true , info, info.attempts.head, true , requestedIncomplete) ++
237
- info.attempts.drop(1 ).flatMap(attemptRow(true , info, _, false , requestedIncomplete))
212
+ private def appWithAttemptRow (info : ApplicationHistoryInfo ): Seq [Node ] = {
213
+ attemptRow(true , info, info.attempts.head, true ) ++
214
+ info.attempts.drop(1 ).flatMap(attemptRow(true , info, _, false ))
238
215
}
239
216
240
217
private def makePageLink (linkPage : Int , showIncomplete : Boolean ): String = {
0 commit comments