hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r1179063 - in /hadoop/common/branches/branch-0.22/mapreduce: CHANGES.txt src/java/org/apache/hadoop/mapred/jobcontrol/Job.java src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
Date Wed, 05 Oct 2011 06:51:17 GMT
Author: shv
Date: Wed Oct  5 06:51:16 2011
New Revision: 1179063

URL: http://svn.apache.org/viewvc?rev=1179063&view=rev
Log:
MAPREDUCE-2531. Fixed jobcontrol to downgrade JobID. Contributed by Robert Evans.

Modified:
    hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt
    hadoop/common/branches/branch-0.22/mapreduce/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java
    hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java

Modified: hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt?rev=1179063&r1=1179062&r2=1179063&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt Wed Oct  5 06:51:16 2011
@@ -616,6 +616,9 @@ Release 0.22.0 - Unreleased
     MAPREDUCE-2779. JobSplitWriter.java can't handle large job.split file.
     (Ming Ma via shv)
 
+    MAPREDUCE-2531. Fixed jobcontrol to downgrade JobID. (Robert Evans via
+    acmurthy)
+
 Release 0.21.1 - Unreleased
 
   NEW FEATURES

Modified: hadoop/common/branches/branch-0.22/mapreduce/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java?rev=1179063&r1=1179062&r2=1179063&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java
(original)
+++ hadoop/common/branches/branch-0.22/mapreduce/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java
Wed Oct  5 06:51:16 2011
@@ -68,7 +68,11 @@ public class Job extends ControlledJob {
    * mapred framework.
    */
   public JobID getAssignedJobID() {
-    return (JobID)super.getMapredJobID();
+    org.apache.hadoop.mapreduce.JobID temp = super.getMapredJobID();
+    if(temp == null) {
+      return null;
+    }
+    return JobID.downgrade(temp);
   }
 
   /**

Modified: hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java?rev=1179063&r1=1179062&r2=1179063&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
(original)
+++ hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
Wed Oct  5 06:51:16 2011
@@ -18,12 +18,15 @@
 
 package org.apache.hadoop.mapred.jobcontrol;
 
+import static org.mockito.Mockito.*;
+
 import java.util.ArrayList;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.mapred.JobConf;
+import org.apache.hadoop.mapred.JobID;
 
 /**
  * This class performs unit test for Job/JobControl classes.
@@ -191,7 +194,21 @@ public class TestJobControl extends juni
   public void testJobControl() throws Exception {
     doJobControlTest();
   }
-    
+  
+  public void testGetAssignedJobId() throws Exception {
+    JobConf jc = new JobConf();
+    Job j = new Job(jc);
+    //Just make sure no exception is thrown
+    assertNull(j.getAssignedJobID());
+    org.apache.hadoop.mapreduce.Job mockjob = mock(org.apache.hadoop.mapreduce.Job.class);
+    org.apache.hadoop.mapreduce.JobID jid = new org.apache.hadoop.mapreduce.JobID("test",0);
+    when(mockjob.getJobID()).thenReturn(jid);
+    j.setJob(mockjob);
+    JobID expected = new JobID("test",0);
+    assertEquals(expected, j.getAssignedJobID());
+    verify(mockjob).getJobID();
+  }
+  
   public static void main(String[] args) {
     TestJobControl test = new TestJobControl();
     try {



Mime
View raw message