Browse Source

HADOOP-2817. Removes deprecated mapred.tasktracker.tasks.maximum and ClusterStatus.getMaxTasks(). Contributed by Amareshwari Sri Ramadasu.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@633425 13f79535-47bb-0310-9956-ffa450edef68
Devaraj Das 17 years ago
parent
commit
642a5e1495

+ 3 - 0
CHANGES.txt

@@ -131,6 +131,9 @@ Trunk (unreleased changes)
     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

+ 7 - 3
src/examples/org/apache/hadoop/examples/Join.java

@@ -77,9 +77,13 @@ public class Join extends Configured implements Tool {
     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 = 

+ 0 - 11
src/java/org/apache/hadoop/mapred/ClusterStatus.java

@@ -107,17 +107,6 @@ public class ClusterStatus implements Writable {
     return reduce_tasks;
   }
   
-  /**
-   * 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.
    * 

+ 4 - 36
src/java/org/apache/hadoop/mapred/TaskTracker.java

@@ -769,47 +769,15 @@ public class TaskTracker
     this.mapEventsFetcher.interrupt();
   }
 
-  /**
-   * 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);