diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezJobMonitor.java ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezJobMonitor.java index 70a8195..a91925b 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezJobMonitor.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezJobMonitor.java @@ -48,8 +48,13 @@ private transient LogHelper console; private final PerfLogger perfLogger = PerfLogger.getPerfLogger(); + private final int checkInterval = 200; + private final int maxRetryInterval = 2500; + private final int printInterval = 3000; + private long lastPrintTime; private Set completed; + public TezJobMonitor() { console = new LogHelper(LOG); } @@ -67,10 +72,6 @@ public int monitorExecution(DAGClient dagClient) throws InterruptedException { boolean running = false; boolean done = false; - int checkInterval = 200; - int printInterval = 3000; - int maxRetryInterval = 2500; - int counter = 0; int failedCounter = 0; int rc = 0; DAGStatus.State lastState = null; @@ -81,7 +82,6 @@ public int monitorExecution(DAGClient dagClient) throws InterruptedException { perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.TEZ_SUBMIT_TO_RUNNING); while(true) { - ++counter; try { status = dagClient.getDAGStatus(); @@ -108,9 +108,7 @@ public int monitorExecution(DAGClient dagClient) throws InterruptedException { running = true; } - if (counter % printInterval/checkInterval == 0) { - lastReport = printStatus(progressMap, lastReport, console); - } + lastReport = printStatus(progressMap, lastReport, console); break; case SUCCEEDED: lastReport = printStatus(progressMap, lastReport, console); @@ -190,8 +188,9 @@ private String printStatus(Map progressMap, String lastReport, } String report = reportBuffer.toString(); - if (!report.equals(lastReport)) { + if (!report.equals(lastReport) || System.currentTimeMillis() >= lastPrintTime + printInterval) { console.printInfo(report); + lastPrintTime = System.currentTimeMillis(); } return report;