Github user davies commented on a diff in the pull request: https://github.com/apache/spark/pull/3029#discussion_r19709497 --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala --- @@ -521,6 +529,51 @@ 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 + } + lastUpdate = now + + // show progress in title + if (Terminal.getTerminal.isANSISupported) { + val ESC = "\033" + val title = if (curr < total) { + s"Spark Job: $curr/$total Finished, $runningTasks are running" + } else { + s"Spark Job: Finished in ${Utils.msDurationToString(now - startTime)}" + } + console.printf(s"$ESC]0; $title \007") + } + + // show one line progress bar + if (!log.isInfoEnabled) { + if (curr < total) { + val header = s"Stage $stageId: [" + val tailer = s"] $curr+$runningTasks/$total - ${Utils.msDurationToString(now - startTime)}" + 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("") + console.printf("\r" + header + bar + tailer) --- End diff -- Either stdout or stderr could be redirect to somewhere, but console is the real target. If last log line ws print, it will overwrite it. In most cases, logging will be writted as println.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org