hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r1130992 - in /hadoop/mapreduce/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/jobcontrol/Job.java src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
Date Fri, 03 Jun 2011 11:23:17 GMT
Author: acmurthy
Date: Fri Jun  3 11:23:17 2011
New Revision: 1130992

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

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java
    hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=1130992&r1=1130991&r2=1130992&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Fri Jun  3 11:23:17 2011
@@ -163,6 +163,9 @@ Trunk (unreleased changes)
 
   BUG FIXES
 
+    MAPREDUCE-2531. Fixed jobcontrol to downgrade JobID. (Robert Evans via
+    acmurthy) 
+
     MAPREDUCE-1978. Rumen TraceBuilder should provide recursive
     input folder scanning.
 

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java?rev=1130992&r1=1130991&r2=1130992&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java (original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java Fri Jun 
3 11:23:17 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/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java?rev=1130992&r1=1130991&r2=1130992&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
(original)
+++ hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
Fri Jun  3 11:23:17 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