diff options
author | Sean Owen <sowen@cloudera.com> | 2016-02-01 16:23:17 -0800 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2016-02-01 16:23:17 -0800 |
commit | 715a19d56fc934d4aec5025739ff650daf4580b7 (patch) | |
tree | ac2eded6577505e28e22195843b9d30ac70eec4f /core/src | |
parent | be7a2fc0716b7d25327b6f8f683390fc62532e3b (diff) | |
download | spark-715a19d56fc934d4aec5025739ff650daf4580b7.tar.gz spark-715a19d56fc934d4aec5025739ff650daf4580b7.tar.bz2 spark-715a19d56fc934d4aec5025739ff650daf4580b7.zip |
[SPARK-12637][CORE] Print stage info of finished stages properly
Improve printing of StageInfo in onStageCompleted
See also https://github.com/apache/spark/pull/10585
Author: Sean Owen <sowen@cloudera.com>
Closes #10922 from srowen/SPARK-12637.
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/scala/org/apache/spark/scheduler/SparkListener.scala | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/scheduler/SparkListener.scala b/core/src/main/scala/org/apache/spark/scheduler/SparkListener.scala index ed3adbd81c..7b09c2eded 100644 --- a/core/src/main/scala/org/apache/spark/scheduler/SparkListener.scala +++ b/core/src/main/scala/org/apache/spark/scheduler/SparkListener.scala @@ -270,7 +270,7 @@ class StatsReportListener extends SparkListener with Logging { override def onStageCompleted(stageCompleted: SparkListenerStageCompleted) { implicit val sc = stageCompleted - this.logInfo("Finished stage: " + stageCompleted.stageInfo) + this.logInfo(s"Finished stage: ${getStatusDetail(stageCompleted.stageInfo)}") showMillisDistribution("task runtime:", (info, _) => Some(info.duration), taskInfoMetrics) // Shuffle write @@ -297,6 +297,17 @@ class StatsReportListener extends SparkListener with Logging { taskInfoMetrics.clear() } + private def getStatusDetail(info: StageInfo): String = { + val failureReason = info.failureReason.map("(" + _ + ")").getOrElse("") + val timeTaken = info.submissionTime.map( + x => info.completionTime.getOrElse(System.currentTimeMillis()) - x + ).getOrElse("-") + + s"Stage(${info.stageId}, ${info.attemptId}); Name: '${info.name}'; " + + s"Status: ${info.getStatusString}$failureReason; numTasks: ${info.numTasks}; " + + s"Took: $timeTaken msec" + } + } private[spark] object StatsReportListener extends Logging { |