You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by sr...@apache.org on 2015/11/24 10:03:38 UTC
spark git commit: [SPARK-11906][WEB UI] Speculation Tasks Cause
ProgressBar UI Overflow
Repository: spark
Updated Branches:
refs/heads/master 12eea834d -> 800bd799a
[SPARK-11906][WEB UI] Speculation Tasks Cause ProgressBar UI Overflow
When there are speculative tasks in the stage, running progress bar could overflow and goes hidden on a new line:

3 completed / 2 running (including 1 speculative) out of 4 total tasks
This is a simple fix by capping the started tasks at `total - completed` tasks

I should note my preferred way to fix it is via css style
```css
.progress { display: flex; }
```
which shifts the correction burden from driver to web browser. However I couldn't get selenium test to measure the position/dimension of the progress bar correctly to get this unit tested.
It also has the side effect that the width will be calibrated so the running occupies 2 / 5 instead of 1 / 4.

All in all, since this cosmetic bug is minor enough, I suppose the original simple fix should be good enough.
Author: Forest Fang <fo...@outlook.com>
Closes #9896 from saurfang/progressbar.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/800bd799
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/800bd799
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/800bd799
Branch: refs/heads/master
Commit: 800bd799acf7f10a469d8d6537279953129eb2c6
Parents: 12eea83
Author: Forest Fang <fo...@outlook.com>
Authored: Tue Nov 24 09:03:32 2015 +0000
Committer: Sean Owen <so...@cloudera.com>
Committed: Tue Nov 24 09:03:32 2015 +0000
----------------------------------------------------------------------
core/src/main/scala/org/apache/spark/ui/UIUtils.scala | 4 +++-
.../src/test/scala/org/apache/spark/ui/UIUtilsSuite.scala | 10 ++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/800bd799/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
index 25dcb60..84a1116 100644
--- a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
+++ b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
@@ -319,7 +319,9 @@ private[spark] object UIUtils extends Logging {
skipped: Int,
total: Int): Seq[Node] = {
val completeWidth = "width: %s%%".format((completed.toDouble/total)*100)
- val startWidth = "width: %s%%".format((started.toDouble/total)*100)
+ // 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)
<div class="progress">
<span style="text-align:center; position:absolute; width:100%; left:0;">
http://git-wip-us.apache.org/repos/asf/spark/blob/800bd799/core/src/test/scala/org/apache/spark/ui/UIUtilsSuite.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/org/apache/spark/ui/UIUtilsSuite.scala b/core/src/test/scala/org/apache/spark/ui/UIUtilsSuite.scala
index 2b693c1..dd8d5ec 100644
--- a/core/src/test/scala/org/apache/spark/ui/UIUtilsSuite.scala
+++ b/core/src/test/scala/org/apache/spark/ui/UIUtilsSuite.scala
@@ -57,6 +57,16 @@ class UIUtilsSuite extends SparkFunSuite {
)
}
+ test("SPARK-11906: Progress bar should not overflow because of speculative tasks") {
+ val generated = makeProgressBar(2, 3, 0, 0, 4).head.child.filter(_.label == "div")
+ val expected = Seq(
+ <div class="bar bar-completed" style="width: 75.0%"></div>,
+ <div class="bar bar-running" style="width: 25.0%"></div>
+ )
+ assert(generated.sameElements(expected),
+ s"\nRunning progress bar should round down\n\nExpected:\n$expected\nGenerated:\n$generated")
+ }
+
private def verify(
desc: String, expected: Elem, errorMsg: String = "", baseUrl: String = ""): Unit = {
val generated = makeDescription(desc, baseUrl)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org