Procházet zdrojové kódy

HADOOP-188. More fixes to to JobClient, following on HADOOP-174. Contributed by Owen.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@399030 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting před 19 roky
rodič
revize
0c0d78d8c8
1 změnil soubory, kde provedl 12 přidání a 8 odebrání
  1. 12 8
      src/java/org/apache/hadoop/mapred/JobClient.java

+ 12 - 8
src/java/org/apache/hadoop/mapred/JobClient.java

@@ -308,27 +308,31 @@ public class JobClient implements MRConstants {
         running = jc.submitJob(job);
         String jobId = running.getJobID();
         LOG.info("Running job: " + jobId);
-        while (!running.isComplete()) {
+        while (true) {
           try {
             Thread.sleep(1000);
           } catch (InterruptedException e) {}
           try {
+            if (running.isComplete()) {
+              break;
+            }
             running = jc.getJob(jobId);
+            String report = (" map " + Math.round(running.mapProgress()*100)+
+                             "%  reduce " + 
+                             Math.round(running.reduceProgress()*100) + "%");
+            if (!report.equals(lastReport)) {
+              LOG.info(report);
+              lastReport = report;
+            }
             retries = MAX_RETRIES;
           } catch (IOException ie) {
             if (--retries == 0) {
-              LOG.info("Final attempt failed, killing job.");
+              LOG.warning("Final attempt failed, killing job.");
               throw ie;
             }
             LOG.info("Communication problem with server: " +
                      StringUtils.stringifyException(ie));
           }
-          String report = null;
-          report = " map "+Math.round(running.mapProgress()*100)+"%  reduce " + Math.round(running.reduceProgress()*100)+"%";
-          if (!report.equals(lastReport)) {
-            LOG.info(report);
-            lastReport = report;
-          }
         }
         if (!running.isSuccessful()) {
           throw new IOException("Job failed!");