defReservationId, (PlanQueue) queue); try { resQueue.setEntitlement(new QueueEntitlement(1.0f, 1.0f)); } catch (SchedulerDynamicEditException e) { throw new IllegalStateException(e);
autoCreatedLeafQueue.setEntitlement(new QueueEntitlement(0.9f, 1f)); validateAutoCreatedLeafQueue(0.9); autoCreatedLeafQueue.setEntitlement(new QueueEntitlement(1f, 1f)); validateAutoCreatedLeafQueue(1); autoCreatedLeafQueue.setEntitlement(new QueueEntitlement(0f, 1f)); validateAutoCreatedLeafQueue(0); autoCreatedLeafQueue.setEntitlement(new QueueEntitlement(1.1f, 1f)); fail(); } catch (SchedulerDynamicEditException iae) { autoCreatedLeafQueue.setEntitlement(new QueueEntitlement(-0.1f, 1f)); fail(); } catch (SchedulerDynamicEditException iae) {
return; newQueue.setEntitlement(entitlement); } else { throw new SchedulerDynamicEditException(
reservationQueue.setEntitlement(new QueueEntitlement(0.9f, 1f)); validateReservationQueue(0.9); reservationQueue.setEntitlement(new QueueEntitlement(1f, 1f)); validateReservationQueue(1); reservationQueue.setEntitlement(new QueueEntitlement(0f, 1f)); validateReservationQueue(0); reservationQueue.setEntitlement(new QueueEntitlement(1.1f, 1f)); fail(); } catch (SchedulerDynamicEditException iae) { reservationQueue.setEntitlement(new QueueEntitlement(-0.1f, 1f)); fail(); } catch (SchedulerDynamicEditException iae) {
return; newQueue.setEntitlement(entitlement); } else { throw new SchedulerDynamicEditException(
(PlanQueue) scheduler.getQueue("a")); scheduler.addQueue(defQ); defQ.setEntitlement(new QueueEntitlement(1f, 1f));
(PlanQueue) scheduler.getQueue("a")); scheduler.addQueue(defQ); defQ.setEntitlement(new QueueEntitlement(1f, 1f));
a1.setEntitlement(new QueueEntitlement(A1_CAPACITY / 100, 1f)); cs.addQueue(a1); fail(); .setEntitlement( new QueueEntitlement(0f, 1f)); a1.setEntitlement(new QueueEntitlement(A1_CAPACITY / 100, 1f));
@Test public void testRefreshQueuesWithReservations() throws Exception { CapacityScheduler cs = (CapacityScheduler) rm.getResourceScheduler(); //set default queue capacity to zero ((ReservationQueue) cs .getQueue("a" + ReservationConstants.DEFAULT_QUEUE_SUFFIX)) .setEntitlement( new QueueEntitlement(0f, 1f)); // Test add one reservation dynamically and manually modify capacity ReservationQueue a1 = new ReservationQueue(cs, "a1", (PlanQueue) cs.getQueue("a")); cs.addQueue(a1); a1.setEntitlement(new QueueEntitlement(A1_CAPACITY / 100, 1f)); // Test add another reservation queue and use setEntitlement to modify // capacity ReservationQueue a2 = new ReservationQueue(cs, "a2", (PlanQueue) cs.getQueue("a")); cs.addQueue(a2); cs.setEntitlement("a2", new QueueEntitlement(A2_CAPACITY / 100, 1.0f)); // Verify all allocations match tcs.checkQueueCapacities(cs, A_CAPACITY, B_CAPACITY); // Reinitialize and verify all dynamic queued survived CapacitySchedulerConfiguration conf = cs.getConfiguration(); conf.setCapacity(A, 80f); conf.setCapacity(B, 20f); cs.reinitialize(conf, rm.getRMContext()); tcs.checkQueueCapacities(cs, 80f, 20f); }
a1.setEntitlement(new QueueEntitlement(A1_CAPACITY / 100, 1f)); cs.addQueue(a1); fail(); new ReservationQueue(cs, "a1", (PlanQueue) cs.getQueue("a")); cs.addQueue(a1); a1.setEntitlement(new QueueEntitlement(A1_CAPACITY / 100, 1f));
new ReservationQueue(cs, "a1", (PlanQueue) cs.getQueue("a")); cs.addQueue(a1); a1.setEntitlement(new QueueEntitlement(A1_CAPACITY / 100, 1f));
new ReservationQueue(cs, "a1", (PlanQueue) cs.getQueue("a")); cs.addQueue(a1); a1.setEntitlement(new QueueEntitlement(A1_CAPACITY / 100, 1f));
@Test public void testRefreshQueuesWithReservations() throws Exception { CapacityScheduler cs = (CapacityScheduler) rm.getResourceScheduler(); // Test add one reservation dynamically and manually modify capacity ReservationQueue a1 = new ReservationQueue(cs, "a1", (PlanQueue) cs.getQueue("a")); cs.addQueue(a1); a1.setEntitlement(new QueueEntitlement(A1_CAPACITY / 100, 1f)); // Test add another reservation queue and use setEntitlement to modify // capacity ReservationQueue a2 = new ReservationQueue(cs, "a2", (PlanQueue) cs.getQueue("a")); cs.addQueue(a2); cs.setEntitlement("a2", new QueueEntitlement(A2_CAPACITY / 100, 1.0f)); // Verify all allocations match tcs.checkQueueCapacities(cs, A_CAPACITY, B_CAPACITY); // Reinitialize and verify all dynamic queued survived CapacitySchedulerConfiguration conf = cs.getConfiguration(); conf.setCapacity(A, 80f); conf.setCapacity(B, 20f); cs.reinitialize(conf, rm.getRMContext()); tcs.checkQueueCapacities(cs, 80f, 20f); }