Repository: spark
Updated Branches:
refs/heads/branch-1.5 0e1c9d9ff -> eb0cb25bb
[SPARK-10543] [CORE] Peak Execution Memory Quantile should be Per-task Basis
Read `PEAK_EXECUTION_MEMORY` using `update` to get per task partial value
instead of cumulative value.
I tested with this workload:
```scala
val size = 1000
val repetitions = 10
val data = sc.parallelize(1 to size, 5).map(x => (util.Random.nextInt(size /
repetitions),util.Random.nextDouble)).toDF("key", "value")
val res = data.toDF.groupBy("key").agg(sum("value")).count
```
Before:

After:

Tasks view:

cc andrewor14 I appreciate if you can give feedback on this since I think you
introduced display of this metric.
Author: Forest Fang <[email protected]>
Closes #8726 from saurfang/stagepage.
(cherry picked from commit fd1e8cddf2635c55fec2ac6e1f1c221c9685af0f)
Signed-off-by: Andrew Or <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/eb0cb25b
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/eb0cb25b
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/eb0cb25b
Branch: refs/heads/branch-1.5
Commit: eb0cb25bb81a5aa271d2a0266e5a31b36d1fc071
Parents: 0e1c9d9
Author: Forest Fang <[email protected]>
Authored: Mon Sep 14 15:07:13 2015 -0700
Committer: Andrew Or <[email protected]>
Committed: Mon Sep 14 15:07:24 2015 -0700
----------------------------------------------------------------------
.../org/apache/spark/ui/jobs/StagePage.scala | 2 +-
.../org/apache/spark/ui/StagePageSuite.scala | 29 +++++++++++++++-----
2 files changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/eb0cb25b/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
b/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
index 4adc659..2b71f55 100644
--- a/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
+++ b/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
@@ -368,7 +368,7 @@ private[ui] class StagePage(parent: StagesTab) extends
WebUIPage("stage") {
val peakExecutionMemory = validTasks.map { case TaskUIData(info, _,
_) =>
info.accumulables
.find { acc => acc.name ==
InternalAccumulator.PEAK_EXECUTION_MEMORY }
- .map { acc => acc.value.toLong }
+ .map { acc => acc.update.getOrElse("0").toLong }
.getOrElse(0L)
.toDouble
}
http://git-wip-us.apache.org/repos/asf/spark/blob/eb0cb25b/core/src/test/scala/org/apache/spark/ui/StagePageSuite.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/org/apache/spark/ui/StagePageSuite.scala
b/core/src/test/scala/org/apache/spark/ui/StagePageSuite.scala
index 3388c6d..86699e7 100644
--- a/core/src/test/scala/org/apache/spark/ui/StagePageSuite.scala
+++ b/core/src/test/scala/org/apache/spark/ui/StagePageSuite.scala
@@ -23,7 +23,7 @@ import scala.xml.Node
import org.mockito.Mockito.{mock, when, RETURNS_SMART_NULLS}
-import org.apache.spark.{LocalSparkContext, SparkConf, SparkFunSuite, Success}
+import org.apache.spark._
import org.apache.spark.executor.TaskMetrics
import org.apache.spark.scheduler._
import org.apache.spark.ui.jobs.{JobProgressListener, StagePage, StagesTab}
@@ -47,6 +47,14 @@ class StagePageSuite extends SparkFunSuite with
LocalSparkContext {
assert(html3.contains(targetString))
}
+ test("SPARK-10543: peak execution memory should be per-task rather than
cumulative") {
+ val unsafeConf = "spark.sql.unsafe.enabled"
+ val conf = new SparkConf(false).set(unsafeConf, "true")
+ val html = renderStagePage(conf).toString().toLowerCase
+ // verify min/25/50/75/max show task value not cumulative values
+ assert(html.contains("<td>10.0 b</td>" * 5))
+ }
+
/**
* Render a stage page started with the given conf and return the HTML.
* This also runs a dummy stage to populate the page with useful content.
@@ -67,12 +75,19 @@ class StagePageSuite extends SparkFunSuite with
LocalSparkContext {
// Simulate a stage in job progress listener
val stageInfo = new StageInfo(0, 0, "dummy", 1, Seq.empty, Seq.empty,
"details")
- val taskInfo = new TaskInfo(0, 0, 0, 0, "0", "localhost",
TaskLocality.ANY, false)
- jobListener.onStageSubmitted(SparkListenerStageSubmitted(stageInfo))
- jobListener.onTaskStart(SparkListenerTaskStart(0, 0, taskInfo))
- taskInfo.markSuccessful()
- jobListener.onTaskEnd(
- SparkListenerTaskEnd(0, 0, "result", Success, taskInfo,
TaskMetrics.empty))
+ // Simulate two tasks to test PEAK_EXECUTION_MEMORY correctness
+ (1 to 2).foreach {
+ taskId =>
+ val taskInfo = new TaskInfo(taskId, taskId, 0, 0, "0", "localhost",
TaskLocality.ANY, false)
+ val peakExecutionMemory = 10
+ taskInfo.accumulables += new AccumulableInfo(0,
InternalAccumulator.PEAK_EXECUTION_MEMORY,
+ Some(peakExecutionMemory.toString), (peakExecutionMemory *
taskId).toString, true)
+ jobListener.onStageSubmitted(SparkListenerStageSubmitted(stageInfo))
+ jobListener.onTaskStart(SparkListenerTaskStart(0, 0, taskInfo))
+ taskInfo.markSuccessful()
+ jobListener.onTaskEnd(
+ SparkListenerTaskEnd(0, 0, "result", Success, taskInfo,
TaskMetrics.empty))
+ }
jobListener.onStageCompleted(SparkListenerStageCompleted(stageInfo))
page.render(request)
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]