Skip to content

Commit a68ecf3

Browse files
mmmJoshRosen
authored andcommitted
[SPARK-4141] Hide Accumulators column on stage page when no accumulators exist
WebUI Author: Mark Mims <mark.mims@canonical.com> This patch had conflicts when merged, resolved by Committer: Josh Rosen <joshrosen@databricks.com> Closes #3031 from mmm/remove-accumulators-col and squashes the following commits: 6141cb3 [Mark Mims] reformat to satisfy scalastyle linelength. build failed from jenkins https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22604/ 390893b [Mark Mims] cleanup c28c449 [Mark Mims] looking much better now... minimal explicit formatting. Now, see if any sort keys make sense fb72156 [Mark Mims] mimic hasInput. The basics work here, but wanna clean this up with maybeAccumulators for column content
1 parent 23468e7 commit a68ecf3

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ private[ui] class StagePage(parent: JobProgressTab) extends WebUIPage("stage") {
5353

5454
val numCompleted = tasks.count(_.taskInfo.finished)
5555
val accumulables = listener.stageIdToData((stageId, stageAttemptId)).accumulables
56+
val hasAccumulators = accumulables.size > 0
5657
val hasInput = stageData.inputBytes > 0
5758
val hasShuffleRead = stageData.shuffleReadBytes > 0
5859
val hasShuffleWrite = stageData.shuffleWriteBytes > 0
@@ -144,11 +145,12 @@ private[ui] class StagePage(parent: JobProgressTab) extends WebUIPage("stage") {
144145
val taskHeadersAndCssClasses: Seq[(String, String)] =
145146
Seq(
146147
("Index", ""), ("ID", ""), ("Attempt", ""), ("Status", ""), ("Locality Level", ""),
147-
("Executor ID / Host", ""), ("Launch Time", ""), ("Duration", ""), ("Accumulators", ""),
148+
("Executor ID / Host", ""), ("Launch Time", ""), ("Duration", ""),
148149
("Scheduler Delay", TaskDetailsClassNames.SCHEDULER_DELAY),
149150
("GC Time", TaskDetailsClassNames.GC_TIME),
150151
("Result Serialization Time", TaskDetailsClassNames.RESULT_SERIALIZATION_TIME),
151152
("Getting Result Time", TaskDetailsClassNames.GETTING_RESULT_TIME)) ++
153+
{if (hasAccumulators) Seq(("Accumulators", "")) else Nil} ++
152154
{if (hasInput) Seq(("Input", "")) else Nil} ++
153155
{if (hasShuffleRead) Seq(("Shuffle Read", "")) else Nil} ++
154156
{if (hasShuffleWrite) Seq(("Write Time", ""), ("Shuffle Write", "")) else Nil} ++
@@ -159,7 +161,9 @@ private[ui] class StagePage(parent: JobProgressTab) extends WebUIPage("stage") {
159161
val unzipped = taskHeadersAndCssClasses.unzip
160162

161163
val taskTable = UIUtils.listingTable(
162-
unzipped._1, taskRow(hasInput, hasShuffleRead, hasShuffleWrite, hasBytesSpilled), tasks,
164+
unzipped._1,
165+
taskRow(hasAccumulators, hasInput, hasShuffleRead, hasShuffleWrite, hasBytesSpilled),
166+
tasks,
163167
headerClasses = unzipped._2)
164168
// Excludes tasks which failed and have incomplete metrics
165169
val validTasks = tasks.filter(t => t.taskInfo.status == "SUCCESS" && t.taskMetrics.isDefined)
@@ -298,6 +302,7 @@ private[ui] class StagePage(parent: JobProgressTab) extends WebUIPage("stage") {
298302
}
299303

300304
def taskRow(
305+
hasAccumulators: Boolean,
301306
hasInput: Boolean,
302307
hasShuffleRead: Boolean,
303308
hasShuffleWrite: Boolean,
@@ -312,6 +317,9 @@ private[ui] class StagePage(parent: JobProgressTab) extends WebUIPage("stage") {
312317
val serializationTime = metrics.map(_.resultSerializationTime).getOrElse(0L)
313318
val gettingResultTime = info.gettingResultTime
314319

320+
val maybeAccumulators = info.accumulables
321+
val accumulatorsReadable = maybeAccumulators.map{acc => s"${acc.name}: ${acc.update.get}"}
322+
315323
val maybeInput = metrics.flatMap(_.inputMetrics)
316324
val inputSortable = maybeInput.map(_.bytesRead.toString).getOrElse("")
317325
val inputReadable = maybeInput
@@ -355,10 +363,6 @@ private[ui] class StagePage(parent: JobProgressTab) extends WebUIPage("stage") {
355363
<td sorttable_customkey={duration.toString}>
356364
{formatDuration}
357365
</td>
358-
<td>
359-
{Unparsed(
360-
info.accumulables.map{acc => s"${acc.name}: ${acc.update.get}"}.mkString("<br/>"))}
361-
</td>
362366
<td sorttable_customkey={schedulerDelay.toString}
363367
class={TaskDetailsClassNames.SCHEDULER_DELAY}>
364368
{UIUtils.formatDuration(schedulerDelay.toLong)}
@@ -374,6 +378,11 @@ private[ui] class StagePage(parent: JobProgressTab) extends WebUIPage("stage") {
374378
class={TaskDetailsClassNames.GETTING_RESULT_TIME}>
375379
{UIUtils.formatDuration(gettingResultTime)}
376380
</td>
381+
{if (hasAccumulators) {
382+
<td>
383+
{Unparsed(accumulatorsReadable.mkString("<br/>"))}
384+
</td>
385+
}}
377386
{if (hasInput) {
378387
<td sorttable_customkey={inputSortable}>
379388
{inputReadable}

0 commit comments

Comments
 (0)