aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorForest Fang <forest.fang@outlook.com>2015-11-24 09:03:32 +0000
committerSean Owen <sowen@cloudera.com>2015-11-24 09:03:32 +0000
commit800bd799acf7f10a469d8d6537279953129eb2c6 (patch)
treea6ea4e874baac0955b67ec26155f26e1d1a3b94e /core
parent12eea834d7382fbaa9c92182b682b8724049d7c1 (diff)
downloadspark-800bd799acf7f10a469d8d6537279953129eb2c6.tar.gz
spark-800bd799acf7f10a469d8d6537279953129eb2c6.tar.bz2
spark-800bd799acf7f10a469d8d6537279953129eb2c6.zip
[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: ![image](https://cloud.githubusercontent.com/assets/4317392/11326841/5fd3482e-9142-11e5-8ca5-cb2f0c0c8964.png) 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 ![image](https://cloud.githubusercontent.com/assets/4317392/11326842/6bb67260-9142-11e5-90f0-37f9174878ec.png) 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. ![image](https://cloud.githubusercontent.com/assets/4317392/11326848/7b03e9f0-9142-11e5-89ad-bd99cb0647cf.png) All in all, since this cosmetic bug is minor enough, I suppose the original simple fix should be good enough. Author: Forest Fang <forest.fang@outlook.com> Closes #9896 from saurfang/progressbar.
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/ui/UIUtils.scala4
-rw-r--r--core/src/test/scala/org/apache/spark/ui/UIUtilsSuite.scala10
2 files changed, 13 insertions, 1 deletions
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 25dcb604d9..84a1116a5c 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;">
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 2b693c1651..dd8d5ec27f 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)