hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r1087539 - in /hadoop/common/branches/branch-0.20-security: CHANGES.txt src/mapred/org/apache/hadoop/mapreduce/Job.java src/mapred/org/apache/hadoop/mapreduce/JobContext.java src/test/org/apache/hadoop/mapreduce/TestMapReduceLocal.java
Date Fri, 01 Apr 2011 01:27:07 GMT
Author: cdouglas
Date: Fri Apr  1 01:27:06 2011
New Revision: 1087539

URL: http://svn.apache.org/viewvc?rev=1087539&view=rev
Log:
MAPREDUCE-118 Fix Job.getJobID() to get the new ID as soon as it's assigned.
Contributed by Amareshwari Sriramadasu and Dick King

Modified:
    hadoop/common/branches/branch-0.20-security/CHANGES.txt
    hadoop/common/branches/branch-0.20-security/src/mapred/org/apache/hadoop/mapreduce/Job.java
    hadoop/common/branches/branch-0.20-security/src/mapred/org/apache/hadoop/mapreduce/JobContext.java
    hadoop/common/branches/branch-0.20-security/src/test/org/apache/hadoop/mapreduce/TestMapReduceLocal.java

Modified: hadoop/common/branches/branch-0.20-security/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/CHANGES.txt?rev=1087539&r1=1087538&r2=1087539&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.20-security/CHANGES.txt Fri Apr  1 01:27:06 2011
@@ -22,6 +22,9 @@ Release 0.20.204.0 - unreleased
     MAPREDUCE-2409. Distinguish distributed cache artifacts localized as
     files, archives. (Siddharth Seth via cdouglas)
 
+    MAPREDUCE-118 Fix Job.getJobID() to get the new ID as soon as it's 
+    assigned. (Amareshwari Sriramadasu and Dick King via cdouglas)
+
   IMPROVEMENTS
 
     HDFS-1541. Not marking datanodes dead when namenode in safemode.

Modified: hadoop/common/branches/branch-0.20-security/src/mapred/org/apache/hadoop/mapreduce/Job.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/src/mapred/org/apache/hadoop/mapreduce/Job.java?rev=1087539&r1=1087538&r2=1087539&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security/src/mapred/org/apache/hadoop/mapreduce/Job.java
(original)
+++ hadoop/common/branches/branch-0.20-security/src/mapred/org/apache/hadoop/mapreduce/Job.java
Fri Apr  1 01:27:06 2011
@@ -463,6 +463,7 @@ public class Job extends JobContext {  
     // Connect to the JobTracker and submit the job
     connect();
     info = jobClient.submitJobInternal(conf);
+    super.setJobID(info.getID());
     state = JobState.RUNNING;
    }
   

Modified: hadoop/common/branches/branch-0.20-security/src/mapred/org/apache/hadoop/mapreduce/JobContext.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/src/mapred/org/apache/hadoop/mapreduce/JobContext.java?rev=1087539&r1=1087538&r2=1087539&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security/src/mapred/org/apache/hadoop/mapreduce/JobContext.java
(original)
+++ hadoop/common/branches/branch-0.20-security/src/mapred/org/apache/hadoop/mapreduce/JobContext.java
Fri Apr  1 01:27:06 2011
@@ -49,7 +49,7 @@ public class JobContext {
 
   protected final org.apache.hadoop.mapred.JobConf conf;
   protected final Credentials credentials;
-  private final JobID jobId;
+  private JobID jobId;
 
   public static final String JOB_NAMENODES = "mapreduce.job.hdfs-servers";
 
@@ -83,6 +83,10 @@ public class JobContext {
     }
   }
 
+  void setJobID(JobID jobId) {
+    this.jobId = jobId;
+  }
+
   /**
    * Return the configuration for the job.
    * @return the shared configuration object

Modified: hadoop/common/branches/branch-0.20-security/src/test/org/apache/hadoop/mapreduce/TestMapReduceLocal.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/src/test/org/apache/hadoop/mapreduce/TestMapReduceLocal.java?rev=1087539&r1=1087538&r2=1087539&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security/src/test/org/apache/hadoop/mapreduce/TestMapReduceLocal.java
(original)
+++ hadoop/common/branches/branch-0.20-security/src/test/org/apache/hadoop/mapreduce/TestMapReduceLocal.java
Fri Apr  1 01:27:06 2011
@@ -137,7 +137,14 @@ public class TestMapReduceLocal extends 
     job.setInputFormatClass(TrackingTextInputFormat.class);
     FileInputFormat.addInputPath(job, new Path(TEST_ROOT_DIR + "/in"));
     FileOutputFormat.setOutputPath(job, new Path(TEST_ROOT_DIR + "/out"));
+    assertNull("job.getJobID() must be null before the job is submitted",
+	       job.getJobID());
+    job.submit();
+    assertNotNull("job.getJobID() can't be null after the job is submitted",
+		  job.getJobID());
     assertTrue(job.waitForCompletion(false));
+    assertNotNull("job.getJobID() can't be null again after the job is finished",
+		  job.getJobID());
     String out = readFile("out/part-r-00000");
     System.out.println(out);
     assertEquals("a\t1\ncount\t1\nis\t1\nmore\t1\nof\t1\ntest\t4\nthis\t1\nword\t1\n",



Mime
View raw message