hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r1389821 - in /hadoop/common/branches/branch-1: ./ src/examples/org/apache/hadoop/examples/ src/mapred/org/apache/hadoop/mapred/lib/aggregate/
Date Tue, 25 Sep 2012 11:51:20 GMT
Author: tomwhite
Date: Tue Sep 25 11:51:19 2012
New Revision: 1389821

URL: http://svn.apache.org/viewvc?rev=1389821&view=rev
Log:
MAPREDUCE-4652. ValueAggregatorJob sets the wrong job jar. Contributed by Ahmed Radwan.

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/examples/org/apache/hadoop/examples/AggregateWordCount.java
    hadoop/common/branches/branch-1/src/examples/org/apache/hadoop/examples/AggregateWordHistogram.java
    hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJob.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1389821&r1=1389820&r2=1389821&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Tue Sep 25 11:51:19 2012
@@ -251,6 +251,9 @@ Release 1.2.0 - unreleased
 
     HADOOP-7698. jsvc target fails on x86_64. (daryn via harsh)
 
+    MAPREDUCE-4652. ValueAggregatorJob sets the wrong job jar.
+    (Ahmed Radwan via tomwhite)
+
 Release 1.1.0 - unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-1/src/examples/org/apache/hadoop/examples/AggregateWordCount.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/examples/org/apache/hadoop/examples/AggregateWordCount.java?rev=1389821&r1=1389820&r2=1389821&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/examples/org/apache/hadoop/examples/AggregateWordCount.java
(original)
+++ hadoop/common/branches/branch-1/src/examples/org/apache/hadoop/examples/AggregateWordCount.java
Tue Sep 25 11:51:19 2012
@@ -69,7 +69,7 @@ public class AggregateWordCount {
   @SuppressWarnings("unchecked")
   public static void main(String[] args) throws IOException {
     JobConf conf = ValueAggregatorJob.createValueAggregatorJob(args
-        , new Class[] {WordCountPlugInClass.class});
+        , new Class[] {WordCountPlugInClass.class}, AggregateWordCount.class);
    
     JobClient.runJob(conf);
   }

Modified: hadoop/common/branches/branch-1/src/examples/org/apache/hadoop/examples/AggregateWordHistogram.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/examples/org/apache/hadoop/examples/AggregateWordHistogram.java?rev=1389821&r1=1389820&r2=1389821&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/examples/org/apache/hadoop/examples/AggregateWordHistogram.java
(original)
+++ hadoop/common/branches/branch-1/src/examples/org/apache/hadoop/examples/AggregateWordHistogram.java
Tue Sep 25 11:51:19 2012
@@ -72,8 +72,9 @@ public class AggregateWordHistogram {
    */
   @SuppressWarnings("unchecked")
   public static void main(String[] args) throws IOException {
-    JobConf conf = ValueAggregatorJob.createValueAggregatorJob(args
-        , new Class[] {AggregateWordHistogramPlugin.class});
+    JobConf conf = ValueAggregatorJob.createValueAggregatorJob(args,
+        new Class[] { AggregateWordHistogramPlugin.class },
+        AggregateWordHistogram.class);
     
     JobClient.runJob(conf);
   }

Modified: hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJob.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJob.java?rev=1389821&r1=1389820&r2=1389821&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJob.java
(original)
+++ hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/lib/aggregate/ValueAggregatorJob.java
Tue Sep 25 11:51:19 2012
@@ -85,7 +85,7 @@ public class ValueAggregatorJob {
     
     JobControl theControl = new JobControl("ValueAggregatorJobs");
     ArrayList<Job> dependingJobs = new ArrayList<Job>();
-    JobConf aJobConf = createValueAggregatorJob(args);
+    JobConf aJobConf = createValueAggregatorJob(args, (Class<?>) null);
     if(descriptors != null)
       setAggregatorDescriptors(aJobConf, descriptors);
     Job aJob = new Job(aJobConf, dependingJobs);
@@ -96,18 +96,34 @@ public class ValueAggregatorJob {
   public static JobControl createValueAggregatorJobs(String args[]) throws IOException {
     return createValueAggregatorJobs(args, null);
   }
-  
+
+  /**
+   * Create an Aggregate based map/reduce job.
+   *
+   * @param args the arguments used for job creation. Generic hadoop
+   * arguments are accepted.
+   * @return a JobConf object ready for submission.
+   *
+   * @throws IOException
+   * @see GenericOptionsParser
+   */
+  public static JobConf createValueAggregatorJob(String args[])
+  throws IOException {
+    return createValueAggregatorJob(args, (Class<?>) null);
+  }
+
   /**
    * Create an Aggregate based map/reduce job.
    * 
    * @param args the arguments used for job creation. Generic hadoop
    * arguments are accepted.
+   * @param caller the the caller class.
    * @return a JobConf object ready for submission.
    * 
    * @throws IOException
    * @see GenericOptionsParser
    */
-  public static JobConf createValueAggregatorJob(String args[])
+  public static JobConf createValueAggregatorJob(String args[], Class<?> caller)
     throws IOException {
 
     Configuration conf = new Configuration();
@@ -156,7 +172,7 @@ public class ValueAggregatorJob {
     }
     String userJarFile = theJob.get("user.jar.file");
     if (userJarFile == null) {
-      theJob.setJarByClass(ValueAggregator.class);
+      theJob.setJarByClass(caller != null ? caller : ValueAggregatorJob.class);
     } else {
       theJob.setJar(userJarFile);
     }
@@ -180,10 +196,16 @@ public class ValueAggregatorJob {
     return theJob;
   }
 
+  public static JobConf createValueAggregatorJob(String args[],
+      Class<? extends ValueAggregatorDescriptor>[] descriptors)
+      throws IOException {
+    return createValueAggregatorJob(args, descriptors, null);
+  }
+
   public static JobConf createValueAggregatorJob(String args[]
-    , Class<? extends ValueAggregatorDescriptor>[] descriptors)
+    , Class<? extends ValueAggregatorDescriptor>[] descriptors, Class<?> caller)
   throws IOException {
-    JobConf job = createValueAggregatorJob(args);
+    JobConf job = createValueAggregatorJob(args, caller);
     setAggregatorDescriptors(job, descriptors);
     return job;
   }
@@ -204,7 +226,8 @@ public class ValueAggregatorJob {
    * @throws IOException
    */
   public static void main(String args[]) throws IOException {
-    JobConf job = ValueAggregatorJob.createValueAggregatorJob(args);
+    JobConf job = ValueAggregatorJob.createValueAggregatorJob(args,
+        ValueAggregatorJob.class);
     JobClient.runJob(job);
   }
 }



Mime
View raw message