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 ee06f81..0d42250 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 @@ -254,6 +254,7 @@ public int getTerminalWidth() { */ public int monitorExecution(final DAGClient dagClient, HiveTxnManager txnMgr, HiveConf conf, DAG dag) throws InterruptedException { + long monitorStartTime = System.currentTimeMillis(); DAGStatus status = null; completed = new HashSet(); diagnostics = new StringBuffer(); @@ -293,7 +294,7 @@ public int monitorExecution(final DAGClient dagClient, HiveTxnManager txnMgr, Hi while (true) { try { - status = dagClient.getDAGStatus(opts); + status = dagClient.getDAGStatus(opts, checkInterval); Map progressMap = status.getVertexProgress(); DAGStatus.State state = status.getState(); heartbeater.heartbeat(); @@ -326,6 +327,9 @@ public int monitorExecution(final DAGClient dagClient, HiveTxnManager txnMgr, Hi } break; case SUCCEEDED: + if (!running) { + startTime = monitorStartTime; + } if (inPlaceEligible) { printStatusInPlace(progressMap, startTime, false, dagClient); // log the progress report to log file as well @@ -351,6 +355,9 @@ public int monitorExecution(final DAGClient dagClient, HiveTxnManager txnMgr, Hi done = true; break; case KILLED: + if (!running) { + startTime = monitorStartTime; + } if (inPlaceEligible) { printStatusInPlace(progressMap, startTime, true, dagClient); // log the progress report to log file as well @@ -363,6 +370,9 @@ public int monitorExecution(final DAGClient dagClient, HiveTxnManager txnMgr, Hi break; case FAILED: case ERROR: + if (!running) { + startTime = monitorStartTime; + } if (inPlaceEligible) { printStatusInPlace(progressMap, startTime, true, dagClient); // log the progress report to log file as well @@ -375,9 +385,6 @@ public int monitorExecution(final DAGClient dagClient, HiveTxnManager txnMgr, Hi break; } } - if (!done) { - Thread.sleep(checkInterval); - } } catch (Exception e) { console.printInfo("Exception: " + e.getMessage()); if (++failedCounter % maxRetryInterval / checkInterval == 0