You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by dd...@apache.org on 2008/03/04 12:08:28 UTC

svn commit: r633425 - in /hadoop/core/trunk: CHANGES.txt src/examples/org/apache/hadoop/examples/Join.java src/java/org/apache/hadoop/mapred/ClusterStatus.java src/java/org/apache/hadoop/mapred/TaskTracker.java

Author: ddas
Date: Tue Mar  4 03:08:16 2008
New Revision: 633425

URL: http://svn.apache.org/viewvc?rev=633425&view=rev
Log:
HADOOP-2817. Removes deprecated mapred.tasktracker.tasks.maximum and ClusterStatus.getMaxTasks(). Contributed by Amareshwari Sri Ramadasu.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/examples/org/apache/hadoop/examples/Join.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/ClusterStatus.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=633425&r1=633424&r2=633425&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Mar  4 03:08:16 2008
@@ -131,6 +131,9 @@
     setInputValueClass(Class theClass) setSpeculativeExecution
     getSpeculativeExecution() (Amareshwari Sri Ramadasu via ddas)
 
+    HADOOP-2817. Removes deprecated mapred.tasktracker.tasks.maximum and 
+    ClusterStatus.getMaxTasks(). (Amareshwari Sri Ramadasu via ddas) 
+
 Release 0.16.1 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/core/trunk/src/examples/org/apache/hadoop/examples/Join.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/examples/org/apache/hadoop/examples/Join.java?rev=633425&r1=633424&r2=633425&view=diff
==============================================================================
--- hadoop/core/trunk/src/examples/org/apache/hadoop/examples/Join.java (original)
+++ hadoop/core/trunk/src/examples/org/apache/hadoop/examples/Join.java Tue Mar  4 03:08:16 2008
@@ -77,9 +77,13 @@
     JobClient client = new JobClient(jobConf);
     ClusterStatus cluster = client.getClusterStatus();
     int num_maps = cluster.getTaskTrackers() * 
-    jobConf.getInt("test.sort.maps_per_host", 10);
-    int num_reduces = cluster.getTaskTrackers() * 
-    jobConf.getInt("test.sort.reduces_per_host", cluster.getMaxTasks());
+                   jobConf.getInt("test.sort.maps_per_host", 10);
+    int num_reduces = (int) (cluster.getMaxReduceTasks() * 0.9);
+    String sort_reduces = jobConf.get("test.sort.reduces_per_host");
+    if (sort_reduces != null) {
+       num_reduces = cluster.getTaskTrackers() * 
+                       Integer.parseInt(sort_reduces);
+    }
     Class<? extends InputFormat> inputFormatClass = 
       SequenceFileInputFormat.class;
     Class<? extends OutputFormat> outputFormatClass = 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/ClusterStatus.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/ClusterStatus.java?rev=633425&r1=633424&r2=633425&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/ClusterStatus.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/ClusterStatus.java Tue Mar  4 03:08:16 2008
@@ -108,17 +108,6 @@
   }
   
   /**
-   * Get the maximum capacity for running tasks in the cluster.
-   * 
-   * @return the maximum capacity for running tasks in the cluster.
-   * @deprecated Use {@link #getMaxMapTasks()} and/or
-   *  {@link #getMaxReduceTasks()}
-   */
-  public int getMaxTasks() {
-    return (max_map_tasks + max_reduce_tasks);
-  }
-  
-  /**
    * Get the maximum capacity for running map tasks in the cluster.
    * 
    * @return the maximum capacity for running map tasks in the cluster.

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java?rev=633425&r1=633424&r2=633425&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Tue Mar  4 03:08:16 2008
@@ -770,46 +770,14 @@
   }
 
   /**
-   * Handles deprecated "mapred.tasktracker.tasks.maximum" 
-   * @param newMax new max values specified through 
-   * mapred.tasktracker.map.tasks.maximum or 
-   * mapred.tasktracker.reduce.tasks.maximum
-   * @param oldMax old max value specified through 
-   * mapred.tasktracker.tasks.maximum
-   * @param def default value if max tasks not specified at all.
-   * @return new value supercedes old value. If both new and old values 
-   * are not set, default value is returned.
-   */
-  private int handleDeprecatedMaxTasks(String newMax, 
-                                       String oldMax,
-                                       int def) {
-    try {
-      if (oldMax != null ) {
-        LOG.warn("mapred.tasktracker.tasks.maximum is deprecated. Use " +
-                 "mapred.tasktracker.map.tasks.maximum and " +
-                 "mapred.tasktracker.reduce.tasks.maximum instead.");
-        return Integer.parseInt(oldMax);
-      }
-      if (newMax != null) {
-        return Integer.parseInt(newMax);
-      }
-    } catch (NumberFormatException ne) {
-      return def;
-    }
-    return def;  
-  }
-  
-  /**
    * Start with the local machine name, and the default JobTracker
    */
   public TaskTracker(JobConf conf) throws IOException {
     originalConf = conf;
-    maxCurrentMapTasks = handleDeprecatedMaxTasks(
-                           conf.get("mapred.tasktracker.map.tasks.maximum"),
-                           conf.get("mapred.tasktracker.tasks.maximum"), 2);
-    maxCurrentReduceTasks = handleDeprecatedMaxTasks(
-                         conf.get("mapred.tasktracker.reduce.tasks.maximum"),
-                         conf.get("mapred.tasktracker.tasks.maximum"), 2);
+    maxCurrentMapTasks = conf.getInt(
+                  "mapred.tasktracker.map.tasks.maximum", 2);
+    maxCurrentReduceTasks = conf.getInt(
+                  "mapred.tasktracker.reduce.tasks.maximum", 2);
     this.jobTrackAddr = JobTracker.getAddress(conf);
     this.mapOutputFile = new MapOutputFile();
     this.mapOutputFile.setConf(conf);