hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r785569 - in /hadoop/core/trunk: CHANGES.txt src/mapred/org/apache/hadoop/mapred/JobHistory.java src/test/mapred/org/apache/hadoop/mapred/TestJobHistory.java
Date Wed, 17 Jun 2009 12:24:08 GMT
Author: ddas
Date: Wed Jun 17 12:24:08 2009
New Revision: 785569

URL: http://svn.apache.org/viewvc?rev=785569&view=rev
Log:
HADOOP-5920. Fixes a testcase failure for TestJobHistory. Contributed by Amar Kamat.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobHistory.java
    hadoop/core/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobHistory.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=785569&r1=785568&r2=785569&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Jun 17 12:24:08 2009
@@ -960,6 +960,9 @@
     (usually HDFS) is started at nearly the same time as the JobTracker. 
     (Amar Kamat via ddas)
 
+    HADOOP-5920. Fixes a testcase failure for TestJobHistory. 
+    (Amar Kamat via ddas)
+
 Release 0.20.0 - 2009-04-15
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobHistory.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobHistory.java?rev=785569&r1=785568&r2=785569&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobHistory.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobHistory.java Wed Jun 17 12:24:08
2009
@@ -398,6 +398,13 @@
   }
   
   /**
+   * Get the history location
+   */
+  static Path getJobHistoryLocation() {
+    return new Path(LOG_DIR);
+  } 
+  
+  /**
    * Base class contais utility stuff to manage types key value pairs with enums. 
    */
   static class KeyValuePair{

Modified: hadoop/core/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobHistory.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobHistory.java?rev=785569&r1=785568&r2=785569&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobHistory.java (original)
+++ hadoop/core/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobHistory.java Wed Jun
17 12:24:08 2009
@@ -31,6 +31,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.FsPermission;
@@ -813,6 +814,7 @@
 
     } finally {
       if (mr != null) {
+        cleanupLocalFiles(mr);
         mr.shutdown();
       }
     }
@@ -855,7 +857,7 @@
       assertTrue("User log file " + logFile + " does not exist",
                  fileSys.exists(logFile));
     }
-    else if (conf.get("hadoop.job.history.user.location") == "none") {
+    else if ("none".equals(conf.get("hadoop.job.history.user.location"))) {
       // history file should not exist in the output path
       assertFalse("Unexpected. User log file exists in output dir when " +
                  "hadoop.job.history.user.location is set to \"none\"",
@@ -920,11 +922,24 @@
 
     } finally {
       if (mr != null) {
+        cleanupLocalFiles(mr);
         mr.shutdown();
       }
     }
   }
 
+  private void cleanupLocalFiles(MiniMRCluster mr) 
+  throws IOException {
+    Configuration conf = mr.createJobConf();
+    JobTracker jt = mr.getJobTrackerRunner().getJobTracker();
+    Path sysDir = new Path(jt.getSystemDir());
+    FileSystem fs = sysDir.getFileSystem(conf);
+    fs.delete(sysDir, true);
+    Path jobHistoryDir = JobHistory.getJobHistoryLocation();
+    fs = jobHistoryDir.getFileSystem(conf);
+    fs.delete(jobHistoryDir, true);
+  }
+
   /**
    * Checks if the history file has expected job status
    * @param id job id
@@ -1001,6 +1016,7 @@
       
     } finally {
       if (mr != null) {
+        cleanupLocalFiles(mr);
         mr.shutdown();
       }
     }



Mime
View raw message