Browse Source

Revert "YARN-3969. Allow jobs to be submitted to reservation that is active but does not have any allocations. (subru via curino)" moving this to branch-2.7 per Akira's request.

This reverts commit 5a1d236ba0f9292bff2a27e3bc8d0e73d7755898.
carlo curino 9 years ago
parent
commit
a4c88298d2

+ 0 - 3
hadoop-yarn-project/CHANGES.txt

@@ -184,9 +184,6 @@ Release 2.7.1 - 2015-07-06
     YARN-3850. NM fails to read files from full disks which can lead to
     YARN-3850. NM fails to read files from full disks which can lead to
     container logs being lost and other issues (Varun Saxena via jlowe)
     container logs being lost and other issues (Varun Saxena via jlowe)
 
 
-    YARN-3969. Allow jobs to be submitted to reservation that is active 
-    but does not have any allocations. (subru via curino)
-
 Release 2.7.0 - 2015-04-20
 Release 2.7.0 - 2015-04-20
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 4 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/ReservationQueue.java

@@ -39,9 +39,12 @@ public class ReservationQueue extends LeafQueue {
 
 
   private PlanQueue parent;
   private PlanQueue parent;
 
 
+  private int maxSystemApps;
+
   public ReservationQueue(CapacitySchedulerContext cs, String queueName,
   public ReservationQueue(CapacitySchedulerContext cs, String queueName,
       PlanQueue parent) throws IOException {
       PlanQueue parent) throws IOException {
     super(cs, queueName, parent, null);
     super(cs, queueName, parent, null);
+    maxSystemApps = cs.getConfiguration().getMaximumSystemApplications();
     // the following parameters are common to all reservation in the plan
     // the following parameters are common to all reservation in the plan
     updateQuotas(parent.getUserLimitForReservation(),
     updateQuotas(parent.getUserLimitForReservation(),
         parent.getUserLimitFactor(),
         parent.getUserLimitFactor(),
@@ -87,6 +90,7 @@ public class ReservationQueue extends LeafQueue {
     }
     }
     setCapacity(capacity);
     setCapacity(capacity);
     setAbsoluteCapacity(getParent().getAbsoluteCapacity() * getCapacity());
     setAbsoluteCapacity(getParent().getAbsoluteCapacity() * getCapacity());
+    setMaxApplications((int) (maxSystemApps * getAbsoluteCapacity()));
     // note: we currently set maxCapacity to capacity
     // note: we currently set maxCapacity to capacity
     // this might be revised later
     // this might be revised later
     setMaxCapacity(entitlement.getMaxCapacity());
     setMaxCapacity(entitlement.getMaxCapacity());

+ 12 - 14
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestReservationQueue.java

@@ -18,7 +18,6 @@
 
 
 package org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity;
 package org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity;
 
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.mock;
@@ -40,7 +39,6 @@ public class TestReservationQueue {
 
 
   CapacitySchedulerConfiguration csConf;
   CapacitySchedulerConfiguration csConf;
   CapacitySchedulerContext csContext;
   CapacitySchedulerContext csContext;
-  final static int DEF_MAX_APPS = 10000;
   final static int GB = 1024;
   final static int GB = 1024;
   private final ResourceCalculator resourceCalculator =
   private final ResourceCalculator resourceCalculator =
       new DefaultResourceCalculator();
       new DefaultResourceCalculator();
@@ -68,13 +66,7 @@ public class TestReservationQueue {
     // create a queue
     // create a queue
     PlanQueue pq = new PlanQueue(csContext, "root", null, null);
     PlanQueue pq = new PlanQueue(csContext, "root", null, null);
     reservationQueue = new ReservationQueue(csContext, "a", pq);
     reservationQueue = new ReservationQueue(csContext, "a", pq);
-  }
 
 
-  private void validateReservationQueue(double capacity) {
-    assertTrue(" actual capacity: " + reservationQueue.getCapacity(),
-        reservationQueue.getCapacity() - capacity < CSQueueUtils.EPSILON);
-    assertEquals(reservationQueue.maxApplications, DEF_MAX_APPS);
-    assertEquals(reservationQueue.maxApplicationsPerUser, DEF_MAX_APPS);
   }
   }
 
 
   @Test
   @Test
@@ -82,20 +74,25 @@ public class TestReservationQueue {
 
 
     // verify that setting, adding, subtracting capacity works
     // verify that setting, adding, subtracting capacity works
     reservationQueue.setCapacity(1.0F);
     reservationQueue.setCapacity(1.0F);
-    validateReservationQueue(1);
+    assertTrue(" actual capacity: " + reservationQueue.getCapacity(),
+        reservationQueue.getCapacity() - 1 < CSQueueUtils.EPSILON);
     reservationQueue.setEntitlement(new QueueEntitlement(0.9f, 1f));
     reservationQueue.setEntitlement(new QueueEntitlement(0.9f, 1f));
-    validateReservationQueue(0.9);
+    assertTrue(" actual capacity: " + reservationQueue.getCapacity(),
+        reservationQueue.getCapacity() - 0.9 < CSQueueUtils.EPSILON);
     reservationQueue.setEntitlement(new QueueEntitlement(1f, 1f));
     reservationQueue.setEntitlement(new QueueEntitlement(1f, 1f));
-    validateReservationQueue(1);
+    assertTrue(" actual capacity: " + reservationQueue.getCapacity(),
+        reservationQueue.getCapacity() - 1 < CSQueueUtils.EPSILON);
     reservationQueue.setEntitlement(new QueueEntitlement(0f, 1f));
     reservationQueue.setEntitlement(new QueueEntitlement(0f, 1f));
-    validateReservationQueue(0);
+    assertTrue(" actual capacity: " + reservationQueue.getCapacity(),
+        reservationQueue.getCapacity() < CSQueueUtils.EPSILON);
 
 
     try {
     try {
       reservationQueue.setEntitlement(new QueueEntitlement(1.1f, 1f));
       reservationQueue.setEntitlement(new QueueEntitlement(1.1f, 1f));
       fail();
       fail();
     } catch (SchedulerDynamicEditException iae) {
     } catch (SchedulerDynamicEditException iae) {
       // expected
       // expected
-      validateReservationQueue(1);
+      assertTrue(" actual capacity: " + reservationQueue.getCapacity(),
+          reservationQueue.getCapacity() - 1 < CSQueueUtils.EPSILON);
     }
     }
 
 
     try {
     try {
@@ -103,7 +100,8 @@ public class TestReservationQueue {
       fail();
       fail();
     } catch (SchedulerDynamicEditException iae) {
     } catch (SchedulerDynamicEditException iae) {
       // expected
       // expected
-      validateReservationQueue(1);
+      assertTrue(" actual capacity: " + reservationQueue.getCapacity(),
+          reservationQueue.getCapacity() - 1 < CSQueueUtils.EPSILON);
     }
     }
 
 
   }
   }