hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r1130989 - in /hadoop/mapreduce/branches/MR-279: CHANGES.txt mr-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/jobcontrol/Job.java src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
Date Fri, 03 Jun 2011 11:16:21 GMT
Author: acmurthy
Date: Fri Jun  3 11:16:20 2011
New Revision: 1130989

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

Modified:
    hadoop/mapreduce/branches/MR-279/CHANGES.txt
    hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/jobcontrol/Job.java
    hadoop/mapreduce/branches/MR-279/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java

Modified: hadoop/mapreduce/branches/MR-279/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/CHANGES.txt?rev=1130989&r1=1130988&r2=1130989&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/CHANGES.txt (original)
+++ hadoop/mapreduce/branches/MR-279/CHANGES.txt Fri Jun  3 11:16:20 2011
@@ -4,13 +4,19 @@ Trunk (unreleased changes)
 
 
     MAPREDUCE-279
+
+    MAPREDUCE-2531. Fixed jobcontrol to downgrade JobID. (Robert Evans via
+    acmurthy) 
+
     Support for min and max container capacity. (acmurthy and sharad)
 
     Re-enabled TestCapacityScheduler. (acmurthy)
 
-    Fix logging for showing the state of job (FAILED/KILLED/SUCCEEDED) when it completes
(mahadev)
+    Fix logging for showing the state of job (FAILED/KILLED/SUCCEEDED) when it 
+    completes (mahadev)
 
-    MAPREDUCE-2537. The RM writes its log to yarn-mapred-resourcemanager-<RM_Host>.out
(Robert Evans via mahadev)
+    MAPREDUCE-2537. The RM writes its log to 
+    yarn-mapred-resourcemanager-<RM_Host>.out (Robert Evans via mahadev)
 
     Fix a corner case in headroom computation - now reservations are taken
     into account and headroom is computed much later to account for

Modified: hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/jobcontrol/Job.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/jobcontrol/Job.java?rev=1130989&r1=1130988&r2=1130989&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/jobcontrol/Job.java
(original)
+++ hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/jobcontrol/Job.java
Fri Jun  3 11:16:20 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/branches/MR-279/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java?rev=1130989&r1=1130988&r2=1130989&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
(original)
+++ hadoop/mapreduce/branches/MR-279/src/test/mapred/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java
Fri Jun  3 11:16:20 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