hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r427231 - in /lucene/hadoop/trunk: CHANGES.txt build.xml src/test/org/apache/hadoop/mapred/MiniMRCluster.java
Date Mon, 31 Jul 2006 19:45:32 GMT
Author: cutting
Date: Mon Jul 31 12:45:31 2006
New Revision: 427231

URL: http://svn.apache.org/viewvc?rev=427231&view=rev
Log:
HADOOP-389.  Fix intermitten t failures of mapreduce unit tests.  Also fix some build dependencies.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/build.xml
    lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=427231&r1=427230&r2=427231&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon Jul 31 12:45:31 2006
@@ -101,6 +101,10 @@
     on nodes with the least free space first.
     (Johan Oskarson via cutting)
 
+29. HADOOP-389.  Fix intermittent failures of mapreduce unit tests.
+    Also fix some build dependencies.
+    (Mahadev & Konstantin via cutting)
+
 
 Release 0.4.0 - 2006-06-28
 

Modified: lucene/hadoop/trunk/build.xml
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/build.xml?rev=427231&r1=427230&r2=427231&view=diff
==============================================================================
--- lucene/hadoop/trunk/build.xml (original)
+++ lucene/hadoop/trunk/build.xml Mon Jul 31 12:45:31 2006
@@ -253,7 +253,7 @@
   <!-- ================================================================== -->
   <!-- Compile test code                                                  --> 
   <!-- ================================================================== -->
-  <target name="compile-core-test" depends="compile-core, jar">
+  <target name="compile-core-test" depends="compile-examples">
     <javac 
      encoding="${build.encoding}" 
      srcdir="${test.src.dir}"
@@ -278,7 +278,7 @@
   <!-- ================================================================== -->
   <!-- Run unit tests                                                     --> 
   <!-- ================================================================== -->
-  <target name="test-core" depends="compile-core, examples, compile-core-test">
+  <target name="test-core" depends="compile-core-test">
 
     <delete dir="${test.build.data}"/>
     <mkdir dir="${test.build.data}"/>

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java?rev=427231&r1=427230&r2=427231&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java Mon Jul 31 12:45:31
2006
@@ -80,6 +80,8 @@
     class TaskTrackerRunner implements Runnable {
         TaskTracker tt;
         String localDir;
+        boolean isInitialized = false;
+        boolean isDead = false;
         
         /**
          * Create and run the task tracker.
@@ -101,8 +103,10 @@
                 this.localDir = ttDir.getAbsolutePath();
                 jc.set("mapred.local.dir", ttDir.getAbsolutePath());
                 tt = new TaskTracker(jc);
+                isInitialized = true;
                 tt.run();
             } catch (Throwable e) {
+                isDead = true;
                 tt = null;
                 System.err.println("Task tracker crashed:");
                 e.printStackTrace();
@@ -154,10 +158,14 @@
      */
     public void waitUntilIdle() {
       for(Iterator itr= taskTrackerList.iterator(); itr.hasNext(); ) {
-        TaskTracker tracker = ((TaskTrackerRunner) itr.next()).tt;
-        while (!tracker.isIdle()) {
-          System.out.println("Waiting for task tracker " + tracker.getName() +
-                             " to finish.");
+        TaskTrackerRunner runner = (TaskTrackerRunner) itr.next();
+        while (!runner.isDead && (!runner.isInitialized || !runner.tt.isIdle()))
{
+          if (!runner.isInitialized) {
+            System.out.println("Waiting for task tracker to start.");
+          } else {
+            System.out.println("Waiting for task tracker " + runner.tt.getName() +
+                               " to be idle.");
+          }
           try {
             Thread.sleep(1000);
           } catch (InterruptedException ie) {}
@@ -206,17 +214,15 @@
         if (taskTrackerFirst) {
           jobTrackerThread.start();
         }
-        try {                                     // let taskTrackers get started
-            Thread.sleep(2000);
-        } catch(InterruptedException e) {
-        }
+        waitUntilIdle();
     }
     
     /**
      * Shut down the servers.
      */
     public void shutdown() {
-        try {
+      try {
+        waitUntilIdle();
         for (int idx = 0; idx < numTaskTrackers; idx++) {
             TaskTrackerRunner taskTracker = (TaskTrackerRunner) taskTrackerList.get(idx);
             Thread taskTrackerThread = (Thread) taskTrackerThreadList.get(idx);



Mime
View raw message