Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/3029#discussion_r19697163
--- Diff:
core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
@@ -521,6 +528,47 @@ private[spark] class TaskSetManager(
sched.dagScheduler.taskGettingResult(info)
}
+ private def progressBar(curr: Int, total: Int): Unit = {
+ val now = clock.getTime()
+ // Only update title once in one second
+ if (now - lastUpdate < 100 && curr < total) {
+ return
+ }
+ val SetTitle = "\033]0;"
+ val EndTitle = "\007"
+ if (curr < total) {
+ System.err.print(s"${SetTitle} Spark Job: $curr/$total Finished, " +
+ s"$runningTasks are running ${EndTitle}")
+
+ if (!log.isInfoEnabled) {
+ val used = (now - startTime) / 1000
+ val header = s"Stage ${stageId}: ["
+ val tailer = s"] ${curr}+${runningTasks}/${total} - ${used}s"
+ val width = Terminal.getTerminal.getTerminalWidth - header.size -
tailer.size
+ val percent = curr * width / total;
+ val bar = (0 until width).map { i =>
+ if (i < percent) "=" else if (i==percent) ">" else " "
+ }.mkString("")
+ System.err.print(header + bar + tailer + s"\n${ANSICodes.up(0)}")
+ }
+ } else {
+ System.err.print(s"${SetTitle} Spark Job: All Finished ${EndTitle}")
+ if (!log.isInfoEnabled) {
+ val used = (now - startTime) / 1000
+ val finishTimes = taskInfos.map(_._2.finishTime - startTime)
+ val avg = finishTimes.sum / finishTimes.size / 1000
+ val min = finishTimes.min / 1000
+ val max = finishTimes.max / 1000
+ val med = finishTimes.toSeq.sorted.slice(0, finishTimes.size /
2).last / 1000
+ // erase current line
+ System.err.print(" " * Terminal.getTerminal.getTerminalWidth +
"\n" + ANSICodes.up(0))
+ System.err.println(s"Stage ${stageId}: Finished in ${used}s with
${total} tasks " +
+ s"(${min}/${med}/${avg}/${max}s).")
--- End diff --
Maybe we could explicitly say `min=*/median=*/avg=*/max=*` to make this
clearer to useres?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]