Explorar el Código

MAPREDUCE-2621. TestCapacityScheduler fails with "Queue "q1" does not exist".

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security@1150528 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar hace 14 años
padre
commit
e477d651e9

+ 3 - 0
CHANGES.txt

@@ -26,6 +26,9 @@ Release 0.20.205.0 - unreleased
     HADOOP-7314. Add support for throwing UnknownHostException when a host
     doesn't resolve. Needed for MAPREDUCE-2489. (Jeffrey Naisbitt via mattf)
 
+    MAPREDUCE-2621. TestCapacityScheduler fails with "Queue "q1" does not exist".
+    (Sherry Chen via mahadev)
+
 Release 0.20.204.0 - unreleased
 
   NEW FEATURES

+ 1 - 1
src/contrib/capacity-scheduler/src/test/org/apache/hadoop/mapred/TestCapacityScheduler.java

@@ -794,7 +794,7 @@ public class TestCapacityScheduler extends TestCase {
     FakeJobInProgress job =
         new FakeJobInProgress(new JobID("test", ++jobCounter),
             (jobConf == null ? new JobConf(conf) : jobConf), taskTrackerManager,
-            jobConf.getUser(), UtilsForTests.getJobTracker());
+            jobConf.getUser(), UtilsForTests.getJobTracker(taskTrackerManager.getQueueManager()));
     job.getStatus().setRunState(state);
     taskTrackerManager.submitJob(job);
     return job;

+ 13 - 5
src/mapred/org/apache/hadoop/mapred/JobTracker.java

@@ -2165,6 +2165,11 @@ public class JobTracker implements MRConstants, InterTrackerProtocol,
     this(conf, generateNewIdentifier());
   }
 
+  JobTracker(JobConf conf, QueueManager qm) 
+  throws IOException, InterruptedException {
+    this(conf, generateNewIdentifier(), new Clock(), qm);
+  }
+
   JobTracker(JobConf conf, Clock clock) 
   throws IOException, InterruptedException {
     this(conf, generateNewIdentifier(), clock);
@@ -2178,9 +2183,16 @@ public class JobTracker implements MRConstants, InterTrackerProtocol,
   throws IOException, InterruptedException {   
     this(conf, identifier, new Clock());
   }
-  
+
   JobTracker(final JobConf conf, String identifier, Clock clock) 
   throws IOException, InterruptedException { 
+
+    this(conf, identifier, clock, new QueueManager(new Configuration(conf)));
+  } 
+  
+  JobTracker(final JobConf conf, String identifier, Clock clock, QueueManager qm) 
+  throws IOException, InterruptedException { 
+    this.queueManager = qm;
     this.clock = clock;
     // Set ports, start RPC servers, setup security policy etc.
     InetSocketAddress addr = getAddress(conf);
@@ -2271,10 +2283,6 @@ public class JobTracker implements MRConstants, InterTrackerProtocol,
     // Read the hosts/exclude files to restrict access to the jobtracker.
     this.hostsReader = new HostsFileReader(conf.get("mapred.hosts", ""),
                                            conf.get("mapred.hosts.exclude", ""));
-
-    Configuration queuesConf = new Configuration(this.conf);
-    queueManager = new QueueManager(queuesConf);
-
     aclsManager = new ACLsManager(conf, new JobACLsManager(conf), queueManager);
 
     LOG.info("Starting jobtracker with owner as " +

+ 9 - 1
src/test/org/apache/hadoop/mapred/UtilsForTests.java

@@ -825,12 +825,20 @@ public class UtilsForTests {
   }
 
   static JobTracker getJobTracker() {
+    return(getJobTracker(null));
+  }
+
+  static JobTracker getJobTracker(QueueManager qm) {
     JobConf conf = new JobConf();
     conf.set("mapred.job.tracker", "localhost:0");
     conf.set("mapred.job.tracker.http.address", "0.0.0.0:0");
     JobTracker jt;
     try {
-      jt = new JobTracker(conf);
+      if (qm == null) {
+       jt = new JobTracker(conf);
+      } else {
+        jt = new JobTracker(conf, qm);
+      }
       return jt;
     } catch (Exception e) {
       throw new RuntimeException("Could not start jt", e);