浏览代码

HADOOP-2376. Prevents sort example from overriding the number of maps. Contributed by Owen O'Malley.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@604409 13f79535-47bb-0310-9956-ffa450edef68
Devaraj Das 17 年之前
父节点
当前提交
60ebf4cd67
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 3 0
      CHANGES.txt
  2. 1 4
      src/examples/org/apache/hadoop/examples/Sort.java

+ 3 - 0
CHANGES.txt

@@ -240,6 +240,9 @@ Trunk (unreleased changes)
     HADOOP-2323. JobTracker.close() should not print stack traces for
     HADOOP-2323. JobTracker.close() should not print stack traces for
     normal exit.  (jimk via cutting)
     normal exit.  (jimk via cutting)
 
 
+    HADOOP-2376. Prevents sort example from overriding the number of maps.
+    (Owen O'Malley via ddas)
+
 Branch 0.15 (unreleased)
 Branch 0.15 (unreleased)
 
 
   BUG FIXES
   BUG FIXES

+ 1 - 4
src/examples/org/apache/hadoop/examples/Sort.java

@@ -74,8 +74,6 @@ public class Sort extends Configured implements Tool {
 
 
     JobClient client = new JobClient(jobConf);
     JobClient client = new JobClient(jobConf);
     ClusterStatus cluster = client.getClusterStatus();
     ClusterStatus cluster = client.getClusterStatus();
-    int num_maps = cluster.getTaskTrackers() * 
-    jobConf.getInt("test.sort.maps_per_host", 10);
     int num_reduces = (int) (cluster.getMaxReduceTasks() * 0.9);
     int num_reduces = (int) (cluster.getMaxReduceTasks() * 0.9);
     String sort_reduces = jobConf.get("test.sort.reduces_per_host");
     String sort_reduces = jobConf.get("test.sort.reduces_per_host");
     if (sort_reduces != null) {
     if (sort_reduces != null) {
@@ -92,7 +90,7 @@ public class Sort extends Configured implements Tool {
     for(int i=0; i < args.length; ++i) {
     for(int i=0; i < args.length; ++i) {
       try {
       try {
         if ("-m".equals(args[i])) {
         if ("-m".equals(args[i])) {
-          num_maps = Integer.parseInt(args[++i]);
+          jobConf.setNumMapTasks(Integer.parseInt(args[++i]));
         } else if ("-r".equals(args[i])) {
         } else if ("-r".equals(args[i])) {
           num_reduces = Integer.parseInt(args[++i]);
           num_reduces = Integer.parseInt(args[++i]);
         } else if ("-inFormat".equals(args[i])) {
         } else if ("-inFormat".equals(args[i])) {
@@ -121,7 +119,6 @@ public class Sort extends Configured implements Tool {
     }
     }
 
 
     // Set user-supplied (possibly default) job configs
     // Set user-supplied (possibly default) job configs
-    jobConf.setNumMapTasks(num_maps);
     jobConf.setNumReduceTasks(num_reduces);
     jobConf.setNumReduceTasks(num_reduces);
 
 
     jobConf.setInputFormat(inputFormatClass);
     jobConf.setInputFormat(inputFormatClass);