Skip to content

Commit

Permalink
[SPARK-12637][CORE] Print stage info of finished stages properly
Browse files Browse the repository at this point in the history
Improve printing of StageInfo in onStageCompleted

See also #10585

Author: Sean Owen <sowen@cloudera.com>

Closes #10922 from srowen/SPARK-12637.
  • Loading branch information
srowen authored and Andrew Or committed Feb 2, 2016
1 parent be7a2fc commit 715a19d
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit 715a19d

Please sign in to comment.