merge MAPREDUCE-3856 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1245277 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Siddharth Seth 2012-02-17 01:03:00 +00:00
parent 24fd4a0246
commit e2beaf7976
3 changed files with 35 additions and 4 deletions

View File

@ -26,6 +26,10 @@ Release 0.23.2 - UNRELEASED
MAPREDUCE-3864. Fix cluster setup docs for correct SecondaryNameNode MAPREDUCE-3864. Fix cluster setup docs for correct SecondaryNameNode
HTTPS parameters. (todd) HTTPS parameters. (todd)
MAPREDUCE-3856. Instances of RunningJob class givs incorrect job tracking
urls when mutiple jobs are submitted from same client jvm. (Eric Payne via
sseth)
Release 0.23.1 - 2012-02-08 Release 0.23.1 - 2012-02-08
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -81,8 +81,7 @@ public class ClientServiceDelegate {
private static final Log LOG = LogFactory.getLog(ClientServiceDelegate.class); private static final Log LOG = LogFactory.getLog(ClientServiceDelegate.class);
// Caches for per-user NotRunningJobs // Caches for per-user NotRunningJobs
private static HashMap<JobState, HashMap<String, NotRunningJob>> notRunningJobs = private HashMap<JobState, HashMap<String, NotRunningJob>> notRunningJobs;
new HashMap<JobState, HashMap<String, NotRunningJob>>();
private final Configuration conf; private final Configuration conf;
private final JobID jobId; private final JobID jobId;
@ -108,6 +107,7 @@ public class ClientServiceDelegate {
this.jobId = jobId; this.jobId = jobId;
this.historyServerProxy = historyServerProxy; this.historyServerProxy = historyServerProxy;
this.appId = TypeConverter.toYarn(jobId).getAppId(); this.appId = TypeConverter.toYarn(jobId).getAppId();
notRunningJobs = new HashMap<JobState, HashMap<String, NotRunningJob>>();
} }
// Get the instance of the NotRunningJob corresponding to the specified // Get the instance of the NotRunningJob corresponding to the specified

View File

@ -148,10 +148,15 @@ public class TestMRJobs {
job.addFileToClassPath(APP_JAR); // The AppMaster jar itself. job.addFileToClassPath(APP_JAR); // The AppMaster jar itself.
job.setJarByClass(SleepJob.class); job.setJarByClass(SleepJob.class);
job.setMaxMapAttempts(1); // speed up failures job.setMaxMapAttempts(1); // speed up failures
job.waitForCompletion(true); job.submit();
String trackingUrl = job.getTrackingURL();
String jobId = job.getJobID().toString();
boolean succeeded = job.waitForCompletion(true); boolean succeeded = job.waitForCompletion(true);
Assert.assertTrue(succeeded); Assert.assertTrue(succeeded);
Assert.assertEquals(JobStatus.State.SUCCEEDED, job.getJobState()); Assert.assertEquals(JobStatus.State.SUCCEEDED, job.getJobState());
Assert.assertTrue("Tracking URL was " + trackingUrl +
" but didn't Match Job ID " + jobId ,
trackingUrl.endsWith(jobId.substring(jobId.lastIndexOf("_")) + "/"));
verifySleepJobCounters(job); verifySleepJobCounters(job);
verifyTaskProgress(job); verifyTaskProgress(job);
@ -209,9 +214,15 @@ public class TestMRJobs {
job.addFileToClassPath(APP_JAR); // The AppMaster jar itself. job.addFileToClassPath(APP_JAR); // The AppMaster jar itself.
job.setJarByClass(RandomTextWriterJob.class); job.setJarByClass(RandomTextWriterJob.class);
job.setMaxMapAttempts(1); // speed up failures job.setMaxMapAttempts(1); // speed up failures
job.submit();
String trackingUrl = job.getTrackingURL();
String jobId = job.getJobID().toString();
boolean succeeded = job.waitForCompletion(true); boolean succeeded = job.waitForCompletion(true);
Assert.assertTrue(succeeded); Assert.assertTrue(succeeded);
Assert.assertEquals(JobStatus.State.SUCCEEDED, job.getJobState()); Assert.assertEquals(JobStatus.State.SUCCEEDED, job.getJobState());
Assert.assertTrue("Tracking URL was " + trackingUrl +
" but didn't Match Job ID " + jobId ,
trackingUrl.endsWith(jobId.substring(jobId.lastIndexOf("_")) + "/"));
// Make sure there are three files in the output-dir // Make sure there are three files in the output-dir
@ -316,9 +327,14 @@ public class TestMRJobs {
new Path(mrCluster.getTestWorkDir().getAbsolutePath(), new Path(mrCluster.getTestWorkDir().getAbsolutePath(),
"failmapper-output")); "failmapper-output"));
job.addFileToClassPath(APP_JAR); // The AppMaster jar itself. job.addFileToClassPath(APP_JAR); // The AppMaster jar itself.
job.submit();
String trackingUrl = job.getTrackingURL();
String jobId = job.getJobID().toString();
boolean succeeded = job.waitForCompletion(true); boolean succeeded = job.waitForCompletion(true);
Assert.assertFalse(succeeded); Assert.assertFalse(succeeded);
Assert.assertTrue("Tracking URL was " + trackingUrl +
" but didn't Match Job ID " + jobId ,
trackingUrl.endsWith(jobId.substring(jobId.lastIndexOf("_")) + "/"));
return job; return job;
} }
@ -360,8 +376,14 @@ public class TestMRJobs {
// //Job with reduces // //Job with reduces
// Job job = sleepJob.createJob(3, 2, 10000, 1, 10000, 1); // Job job = sleepJob.createJob(3, 2, 10000, 1, 10000, 1);
job.addFileToClassPath(APP_JAR); // The AppMaster jar itself. job.addFileToClassPath(APP_JAR); // The AppMaster jar itself.
job.submit();
String trackingUrl = job.getTrackingURL();
String jobId = job.getJobID().toString();
job.waitForCompletion(true); job.waitForCompletion(true);
Assert.assertEquals(JobStatus.State.SUCCEEDED, job.getJobState()); Assert.assertEquals(JobStatus.State.SUCCEEDED, job.getJobState());
Assert.assertTrue("Tracking URL was " + trackingUrl +
" but didn't Match Job ID " + jobId ,
trackingUrl.endsWith(jobId.substring(jobId.lastIndexOf("_")) + "/"));
return null; return null;
} }
}); });
@ -444,7 +466,12 @@ public class TestMRJobs {
job.setMaxMapAttempts(1); // speed up failures job.setMaxMapAttempts(1); // speed up failures
job.submit(); job.submit();
String trackingUrl = job.getTrackingURL();
String jobId = job.getJobID().toString();
Assert.assertTrue(job.waitForCompletion(false)); Assert.assertTrue(job.waitForCompletion(false));
Assert.assertTrue("Tracking URL was " + trackingUrl +
" but didn't Match Job ID " + jobId ,
trackingUrl.endsWith(jobId.substring(jobId.lastIndexOf("_")) + "/"));
} }
private Path createTempFile(String filename, String contents) private Path createTempFile(String filename, String contents)