Skip to content
Snippets Groups Projects
Commit 715a19d5 authored by Sean Owen's avatar Sean Owen Committed by Andrew Or
Browse files

[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.
parent be7a2fc0
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment