Skip to content

Commit 694796e

Browse files
author
guliangliang
committed
remove duplicate code
1 parent a20e390 commit 694796e

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

core/src/main/scala/org/apache/spark/deploy/master/ui/MasterPage.scala

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private[spark] class MasterPage(parent: MasterWebUI) extends WebUIPage("") {
5050
val workers = state.workers.sortBy(_.id)
5151
val workerTable = UIUtils.listingTable(workerHeaders, workerRow, workers)
5252

53-
val activeAppHeaders = Seq("Application ID", "Name", "Cores Using",
53+
val activeAppHeaders = Seq("Application ID", "Name", "Cores in Use",
5454
"Cores Requested", "Memory per Node", "Submitted Time", "User", "State", "Duration")
5555
val activeApps = state.activeApps.sortBy(_.startTime).reverse
5656
val activeAppsTable = UIUtils.listingTable(activeAppHeaders, activeAppRow, activeApps)
@@ -166,17 +166,21 @@ private[spark] class MasterPage(parent: MasterWebUI) extends WebUIPage("") {
166166
</tr>
167167
}
168168

169-
private def activeAppRow(app: ApplicationInfo): Seq[Node] = {
169+
private def appRow(app: ApplicationInfo, active: Boolean): Seq[Node] = {
170170
<tr>
171171
<td>
172172
<a href={"app?appId=" + app.id}>{app.id}</a>
173173
</td>
174174
<td>
175175
<a href={app.desc.appUiUrl}>{app.desc.name}</a>
176176
</td>
177-
<td>
178-
{app.coresGranted}
179-
</td>
177+
{
178+
if (active) {
179+
<td>
180+
{app.coresGranted}
181+
</td>
182+
}
183+
}
180184
<td>
181185
{app.requestedCores}
182186
</td>
@@ -190,25 +194,12 @@ private[spark] class MasterPage(parent: MasterWebUI) extends WebUIPage("") {
190194
</tr>
191195
}
192196

197+
private def activeAppRow(app: ApplicationInfo): Seq[Node] = {
198+
appRow(app, active = true)
199+
}
200+
193201
private def completeAppRow(app: ApplicationInfo): Seq[Node] = {
194-
<tr>
195-
<td>
196-
<a href={"app?appId=" + app.id}>{app.id}</a>
197-
</td>
198-
<td>
199-
<a href={app.desc.appUiUrl}>{app.desc.name}</a>
200-
</td>
201-
<td>
202-
{app.requestedCores}
203-
</td>
204-
<td sorttable_customkey={app.desc.memoryPerSlave.toString}>
205-
{Utils.megabytesToString(app.desc.memoryPerSlave)}
206-
</td>
207-
<td>{UIUtils.formatDate(app.submitDate)}</td>
208-
<td>{app.desc.user}</td>
209-
<td>{app.state.toString}</td>
210-
<td>{UIUtils.formatDuration(app.duration)}</td>
211-
</tr>
202+
appRow(app, active = false)
212203
}
213204

214205
private def driverRow(driver: DriverInfo): Seq[Node] = {

0 commit comments

Comments
 (0)