hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r758567 - in /hadoop/core/trunk: CHANGES.txt src/mapred/org/apache/hadoop/mapred/HistoryViewer.java
Date Thu, 26 Mar 2009 09:14:57 GMT
Author: cdouglas
Date: Thu Mar 26 09:14:52 2009
New Revision: 758567

URL: http://svn.apache.org/viewvc?rev=758567&view=rev
Log:
HADOOP-5149. Modify HistoryViewer to ignore unfamiliar files in the log
directory. Contributed by Hong Tang

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/HistoryViewer.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=758567&r1=758566&r2=758567&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Mar 26 09:14:52 2009
@@ -327,6 +327,9 @@
     HADOOP-5561. Add javadoc.maxmemory parameter to build, preventing OOM
     exceptions from javadoc-dev. (Jacob Homan via cdouglas)
 
+    HADOOP-5149. Modify HistoryViewer to ignore unfamiliar files in the log
+    directory. (Hong Tang via cdouglas)
+
 Release 0.20.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/HistoryViewer.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/HistoryViewer.java?rev=758567&r1=758566&r2=758567&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/HistoryViewer.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/HistoryViewer.java Thu Mar 26 09:14:52
2009
@@ -32,8 +32,14 @@
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.PathFilter;
-import org.apache.hadoop.mapred.DefaultJobHistoryParser.*;
-import org.apache.hadoop.mapred.JobHistory.*;
+import org.apache.hadoop.mapred.DefaultJobHistoryParser.FailedOnNodesFilter;
+import org.apache.hadoop.mapred.DefaultJobHistoryParser.KilledOnNodesFilter;
+import org.apache.hadoop.mapred.DefaultJobHistoryParser.NodesFilter;
+import org.apache.hadoop.mapred.JobHistory.JobInfo;
+import org.apache.hadoop.mapred.JobHistory.Keys;
+import org.apache.hadoop.mapred.JobHistory.ReduceAttempt;
+import org.apache.hadoop.mapred.JobHistory.TaskAttempt;
+import org.apache.hadoop.mapred.JobHistory.Values;
 import org.apache.hadoop.util.StringUtils;
 
 /**
@@ -72,18 +78,29 @@
       }
       Path[] jobFiles = FileUtil.stat2Paths(fs.listStatus(historyLogDir,
                                                           jobLogFileFilter));
-      if (jobFiles.length == 0) {
-        throw new IOException("Not a valid history directory " 
-                              + historyLogDir.toString());
+      boolean initialized = false;
+      for (Path p : jobFiles) {
+        jobLogFile = p.toString();
+
+        String[] jobDetails =
+            JobInfo.decodeJobHistoryFileName(p.getName()).split("_");
+        if (jobDetails.length < 5) {
+          // NOT a valid name
+          System.err.println("Ignore unrecognized file: " + p.getName());
+          continue;
+        }
+        trackerHostName = jobDetails[0];
+        trackerStartTime = jobDetails[1];
+        jobId = jobDetails[2] + "_" + jobDetails[3] + "_" + jobDetails[4];
+        job = new JobHistory.JobInfo(jobId);
+        DefaultJobHistoryParser.parseJobTasks(jobLogFile, job, fs);
+        initialized = true;
+        break;
+      }
+      if (!initialized) {
+        throw new IOException("No valid history found in directory: "
+            + historyLogDir.toString());
       }
-      jobLogFile = jobFiles[0].toString();
-      String[] jobDetails = 
-          JobInfo.decodeJobHistoryFileName(jobFiles[0].getName()).split("_");
-      trackerHostName = jobDetails[0];
-      trackerStartTime = jobDetails[1];
-      jobId = jobDetails[2] + "_" + jobDetails[3] + "_" + jobDetails[4];
-      job = new JobHistory.JobInfo(jobId); 
-      DefaultJobHistoryParser.parseJobTasks(jobFiles[0].toString(), job, fs);
     } catch(Exception e) {
       throw new IOException("Not able to initialize History viewer", e);
     }



Mime
View raw message