protected void printStatus(Map<String, SparkStageProgress> progressMap, Map<String, SparkStageProgress> lastProgressMap) { // do not print duplicate status while still in middle of print interval. boolean isDuplicateState = isSameAsPreviousProgress(progressMap, lastProgressMap); boolean withinInterval = System.currentTimeMillis() <= lastPrintTime + printInterval; if (isDuplicateState && withinInterval) { return; } String report = getReport(progressMap); if (inPlaceUpdate) { printStatusInPlace(progressMap); console.logInfo(report); } else { console.printInfo(report); } lastPrintTime = System.currentTimeMillis(); }
repositionCursor(); reprintLine(SEPARATOR); reprintLineWithColorAsBold(HEADER, Ansi.Color.CYAN); reprintLine(SEPARATOR); String attempt = div > 0 ? s.substring(div + 1) : "-"; String stageName = "Stage-" + (div > 0 ? s.substring(0, div) : s); String nameWithProgress = getNameWithProgress(stageName, complete, total); reprintMultiLine(reportBuffer.toString()); reprintLine(SEPARATOR); final float progress = (sumTotal == 0) ? 1.0f : (float) sumComplete / (float) sumTotal; String footer = getFooter(numKey, completed.size(), progress, startTime); reprintLineWithColorAsBold(footer, Ansi.Color.RED); reprintLine(SEPARATOR);
private String getFooter(int keySize, int completedSize, float progress, long startTime) { String verticesSummary = String.format("STAGES: %02d/%02d", completedSize, keySize); String progressBar = getInPlaceProgressBar(progress); final int progressPercent = (int) (progress * 100); String progressStr = "" + progressPercent + "%"; float et = (float) (System.currentTimeMillis() - startTime) / (float) 1000; String elapsedTime = "ELAPSED TIME: " + secondsFormat.format(et) + " s"; String footer = String.format(FOOTER_FORMAT, verticesSummary, progressBar, progressStr, elapsedTime); return footer; }
boolean isDuplicateState = isSameAsPreviousProgress(progressMap, lastProgressMap); boolean isPassedInterval = System.currentTimeMillis() <= lastPrintTime + printInterval; if (isDuplicateState && isPassedInterval) {
@Override public void printStatus(Map<SparkStage, SparkStageProgress> progressMap, Map<SparkStage, SparkStageProgress> lastProgressMap) { // do not print duplicate status while still in middle of print interval. boolean isDuplicateState = isSameAsPreviousProgress(progressMap, lastProgressMap); boolean withinInterval = System.currentTimeMillis() <= lastPrintTime + PRINT_INTERVAL; if (isDuplicateState && withinInterval) { return; } String report = getReport(progressMap); renderProgress(monitor.getProgressMonitor(progressMap)); if (showReport(report)) { renderReport(report); lastReport = report; lastPrintTime = System.currentTimeMillis(); } }