hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r700255 - in /hadoop/core/trunk: CHANGES.txt src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacityTaskScheduler.java src/contrib/capacity-scheduler/src/test/org/apache/hadoop/mapred/TestCapacityScheduler.java
Date Mon, 29 Sep 2008 21:00:54 GMT
Author: omalley
Date: Mon Sep 29 14:00:54 2008
New Revision: 700255

URL: http://svn.apache.org/viewvc?rev=700255&view=rev
Log:
HADOOP-4274. Capacity scheduler accidently modifies the underlying 
data structures when browing the job lists. (Hemanth Yamijala via omalley)

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacityTaskScheduler.java
    hadoop/core/trunk/src/contrib/capacity-scheduler/src/test/org/apache/hadoop/mapred/TestCapacityScheduler.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=700255&r1=700254&r2=700255&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Mon Sep 29 14:00:54 2008
@@ -784,6 +784,9 @@
     HADOOP-4237. Fixes the TestStreamingBadRecords.testNarrowDown testcase.
     (Sharad Agarwal via ddas)
 
+    HADOOP-4274. Capacity scheduler accidently modifies the underlying 
+    data structures when browing the job lists. (Hemanth Yamijala via omalley)
+
 Release 0.18.2 - Unreleased
 
   BUG FIXES

Modified: hadoop/core/trunk/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacityTaskScheduler.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacityTaskScheduler.java?rev=700255&r1=700254&r2=700255&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacityTaskScheduler.java
(original)
+++ hadoop/core/trunk/src/contrib/capacity-scheduler/src/java/org/apache/hadoop/mapred/CapacityTaskScheduler.java
Mon Sep 29 14:00:54 2008
@@ -1124,10 +1124,11 @@
   
   @Override
   public synchronized Collection<JobInProgress> getJobs(String queueName) {
-    Collection<JobInProgress> jobCollection = 
-      jobQueuesManager.getRunningJobQueue(queueName);
-    if(jobCollection == null) {
-      jobCollection = new ArrayList<JobInProgress>();
+    Collection<JobInProgress> jobCollection = new ArrayList<JobInProgress>();
+    Collection<JobInProgress> runningJobs = 
+        jobQueuesManager.getRunningJobQueue(queueName);
+    if (runningJobs != null) {
+      jobCollection.addAll(runningJobs);
     }
     Collection<JobInProgress> waitingJobs = 
       jobQueuesManager.getWaitingJobQueue(queueName);

Modified: hadoop/core/trunk/src/contrib/capacity-scheduler/src/test/org/apache/hadoop/mapred/TestCapacityScheduler.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/capacity-scheduler/src/test/org/apache/hadoop/mapred/TestCapacityScheduler.java?rev=700255&r1=700254&r2=700255&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/capacity-scheduler/src/test/org/apache/hadoop/mapred/TestCapacityScheduler.java
(original)
+++ hadoop/core/trunk/src/contrib/capacity-scheduler/src/test/org/apache/hadoop/mapred/TestCapacityScheduler.java
Mon Sep 29 14:00:54 2008
@@ -23,6 +23,7 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -446,6 +447,36 @@
     t = checkAssignment("tt2", "attempt_test_0002_m_000001_0 on tt2");
   }
   
+  public void testGetJobs() throws Exception {
+    // need only one queue
+    String[] qs = { "default" };
+    taskTrackerManager.addQueues(qs);
+    resConf = new FakeResourceManagerConf();
+    ArrayList<FakeQueueInfo> queues = new ArrayList<FakeQueueInfo>();
+    queues.add(new FakeQueueInfo("default", 100.0f, 300, true, 100));
+    resConf.setFakeQueues(queues);
+    scheduler.setResourceManagerConf(resConf);
+    scheduler.start();
+    
+    // submit a job
+    JobInProgress j1 = submitJob(JobStatus.PREP, 10, 10, "default", "u1");
+    checkAssignment("tt1", "attempt_test_0001_m_000001_0 on tt1");
+    
+    // submit another job
+    JobInProgress j2 = submitJob(JobStatus.PREP, 10, 10, "default", "u1");
+    
+    Collection<JobInProgress> jobs = scheduler.getJobs("default");
+    assertEquals(2, jobs.size());
+    Iterator<JobInProgress> iter = jobs.iterator();
+    assertEquals(j1, iter.next());
+    assertEquals(j2, iter.next());
+    
+    assertEquals(1, scheduler.jobQueuesManager.
+                        getRunningJobQueue("default").size());
+    assertEquals(1, scheduler.jobQueuesManager.
+                        getWaitingJobQueue("default").size());
+  }
+  
   // test capacity transfer
   public void testCapacityTransfer() throws Exception {
     // set up some queues



Mime
View raw message