Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/main/resources/org/apache/spark/ui/static/webui.css
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ table.sortable td {
box-shadow: inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);
}

.progress.progress-started {
.progress .progress-bar.progress-started {
background-color: #A0DFFF;
background-image: -moz-linear-gradient(top, #A4EDFF, #94DDFF);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#A4EDFF), to(#94DDFF));
Expand All @@ -124,7 +124,7 @@ table.sortable td {
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#FFA4EDFF', endColorstr='#FF94DDFF', GradientType=0);
}

.progress .progress-bar {
.progress .progress-bar.progress-completed {
background-color: #3EC0FF;
background-image: -moz-linear-gradient(top, #44CBFF, #34B0EE);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#44CBFF), to(#34B0EE));
Expand Down
10 changes: 6 additions & 4 deletions core/src/main/scala/org/apache/spark/ui/UIUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,14 @@ private[spark] object UIUtils extends Logging {
skipped: Int,
reasonToNumKilled: Map[String, Int],
total: Int): Seq[Node] = {
val ratio = if (total == 0) 100.0 else (completed.toDouble/total)*100
val ratio = if (total == 0) 100.0 else (completed.toDouble / total) * 100
val completeWidth = "width: %s%%".format(ratio)
// started + completed can be > total when there are speculative tasks
val boundedStarted = math.min(started, total - completed)
val startWidth = "width: %s%%".format((boundedStarted.toDouble/total)*100)
val startRatio = if (total == 0) 0.0 else (boundedStarted.toDouble / total) * 100
val startWidth = "width: %s%%".format(startRatio)

<div class={ if (started > 0) s"progress progress-started" else s"progress" }>
<div class="progress">
<span style="text-align:center; position:absolute; width:100%;">
{completed}/{total}
{ if (failed == 0 && skipped == 0 && started > 0) s"($started running)" }
Expand All @@ -477,7 +478,8 @@ private[spark] object UIUtils extends Logging {
}
}
</span>
<div class="progress-bar" style={completeWidth}></div>
<div class="progress-bar progress-completed" style={completeWidth}></div>
<div class="progress-bar progress-started" style={startWidth}></div>
</div>
}

Expand Down
3 changes: 2 additions & 1 deletion core/src/test/scala/org/apache/spark/ui/UIUtilsSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ class UIUtilsSuite extends SparkFunSuite {
test("SPARK-11906: Progress bar should not overflow because of speculative tasks") {
val generated = makeProgressBar(2, 3, 0, 0, Map.empty, 4).head.child.filter(_.label == "div")
val expected = Seq(
<div class="progress-bar" style="width: 75.0%"></div>
<div class="progress-bar progress-completed" style="width: 75.0%"></div>,
<div class="progress-bar progress-started" style="width: 25.0%"></div>
)
assert(generated.sameElements(expected),
s"\nRunning progress bar should round down\n\nExpected:\n$expected\nGenerated:\n$generated")
Expand Down