public void initialize(Configuration conf) throws IOException, SAXException, AllocationConfigurationException, ParserConfigurationException { rootQueue = new FSParentQueue("root", scheduler, null); queues.put(rootQueue.getName(), rootQueue); // Create the default queue getLeafQueue(YarnConfiguration.DEFAULT_QUEUE_NAME, true); }
@Override protected void addReservationQueue(String planQueueName, Queue queue, String currResId) { String leafQueueName = getReservationQueueName(planQueueName, currResId); fs.getQueueManager().getLeafQueue(leafQueueName, true); }
@Override protected void addReservationQueue(String planQueueName, Queue queue, String currResId) { String leafQueueName = getReservationQueueName(planQueueName, currResId); fs.getQueueManager().getLeafQueue(leafQueueName, true); }
@Override public void setEntitlement(String queueName, QueueEntitlement entitlement) throws YarnException { FSLeafQueue reservationQueue = queueMgr.getLeafQueue(queueName, false); if (reservationQueue == null) { throw new YarnException("Target queue " + queueName + " not found or is not a leaf queue."); } reservationQueue.setWeights(entitlement.getCapacity()); // TODO Does MaxCapacity need to be set for fairScheduler ? }
@Override protected void createDefaultReservationQueue(String planQueueName, Queue queue, String defReservationId) { String defReservationQueueName = getReservationQueueName(planQueueName, defReservationId); if (!fs.getQueueManager().exists(defReservationQueueName)) { fs.getQueueManager().getLeafQueue(defReservationQueueName, true); } }
@Override protected void createDefaultReservationQueue(String planQueueName, Queue queue, String defReservationId) { String defReservationQueueName = getReservationQueueName(planQueueName, defReservationId); if (!fs.getQueueManager().exists(defReservationQueueName)) { fs.getQueueManager().getLeafQueue(defReservationQueueName, true); } }
@Override protected void createDefaultReservationQueue(String planQueueName, Queue queue, String defReservationId) { String defReservationQueueName = getReservationQueueName(planQueueName, defReservationId); if (!fs.getQueueManager().exists(defReservationQueueName)) { fs.getQueueManager().getLeafQueue(defReservationQueueName, true); } }
@Override protected Queue getReservationQueue(String r) { return fs.getQueueManager().getLeafQueue( plan.getQueueName() + "" + "." + r, false); }
@Override protected Queue getReservationQueue(String r) { return fs.getQueueManager().getLeafQueue(plan.getQueueName() + "" + "." + r, false); }
@Override protected Resource getReservationQueueResourceIfExists(Plan plan, ReservationId reservationId) { String reservationQueueName = getReservationQueueName(plan.getQueueName(), reservationId.toString()); FSLeafQueue reservationQueue = fs.getQueueManager().getLeafQueue(reservationQueueName, false); Resource reservationResource = null; if (reservationQueue != null) { reservationResource = reservationQueue.getSteadyFairShare(); } return reservationResource; }
private void verifyLeafQueueStarvation() { for (String q : QUEUES) { if (!q.equals("no-preemption")) { boolean isStarved = scheduler.getQueueManager().getLeafQueue(q, false).isStarved(); assertTrue(isStarved); } } }
@Override protected void assertReservationQueueExists(ReservationId r, double expectedCapacity, double expectedMaxCapacity) { FSLeafQueue q = fs.getQueueManager().getLeafQueue(plan.getQueueName() + "" + "." + r, false); assertNotNull(q); // For now we are setting both to same weight Assert.assertEquals(expectedCapacity, q.getWeight(), 0.01); }
private void verifyQueueNumRunnable(String queueName, int numRunnableInQueue, int numNonRunnableInQueue) { FSLeafQueue queue = scheduler.getQueueManager().getLeafQueue(queueName, false); assertEquals(numRunnableInQueue, queue.getNumRunnableApps()); assertEquals(numNonRunnableInQueue, queue.getNumNonRunnableApps()); }
private void verifyQueueNumRunnable(String queueName, int numRunnableInQueue, int numNonRunnableInQueue) { FSLeafQueue queue = scheduler.getQueueManager().getLeafQueue(queueName, false); assertEquals(numRunnableInQueue, queue.getNumRunnableApps()); assertEquals(numNonRunnableInQueue, queue.getNumNonRunnableApps()); }
@Test public void testUserAsDefaultQueue() throws Exception { conf.set(FairSchedulerConfiguration.USER_AS_DEFAULT_QUEUE, "true"); scheduler.reinitialize(conf, resourceManager.getRMContext()); ApplicationAttemptId appAttemptId = createAppAttemptId(1, 1); createApplicationWithAMResource(appAttemptId, "default", "user1", null); assertEquals(1, scheduler.getQueueManager().getLeafQueue("user1", true) .getNumRunnableApps()); assertEquals(0, scheduler.getQueueManager().getLeafQueue("default", true) .getNumRunnableApps()); assertEquals("root.user1", resourceManager.getRMContext().getRMApps() .get(appAttemptId.getApplicationId()).getQueue()); }
@Override protected void assertReservationQueueExists(ReservationId r, double expectedCapacity, double expectedMaxCapacity) { FSLeafQueue q = fs.getQueueManager().getLeafQueue(plan.getQueueName() + "" + "." + r, false); assertNotNull(q); // For now we are setting both to same weight Assert.assertEquals(expectedCapacity, q.getWeights().getWeight (ResourceType.MEMORY), 0.01); }
@Test (expected = YarnException.class) public void testMoveWouldViolateMaxAppsConstraints() throws Exception { scheduler.init(conf); scheduler.start(); scheduler.reinitialize(conf, resourceManager.getRMContext()); QueueManager queueMgr = scheduler.getQueueManager(); queueMgr.getLeafQueue("queue2", true); scheduler.getAllocationConfiguration().queueMaxApps.put("root.queue2", 0); ApplicationAttemptId appAttId = createSchedulingRequest(1024, 1, "queue1", "user1", 3); scheduler.moveApplication(appAttId.getApplicationId(), "queue2"); }
/** * Test simple leaf queue creation. */ @Test public void testCreateLeafQueue() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); FSQueue q1 = queueManager.createQueue("root.queue1", FSQueueType.LEAF); assertNotNull("Leaf queue root.queue1 was not created", queueManager.getLeafQueue("root.queue1", false)); assertEquals("createQueue() returned wrong queue", "root.queue1", q1.getName()); }
@Test (expected = YarnException.class) public void testMoveToNonexistentQueue() throws Exception { scheduler.init(conf); scheduler.start(); scheduler.reinitialize(conf, resourceManager.getRMContext()); scheduler.getQueueManager().getLeafQueue("queue1", true); ApplicationAttemptId appAttId = createSchedulingRequest(1024, 1, "queue1", "user1", 3); scheduler.moveApplication(appAttId.getApplicationId(), "queue2"); }
@Test (expected = YarnException.class) public void testMoveWouldViolateMaxAppsConstraints() throws Exception { scheduler.init(conf); scheduler.start(); scheduler.reinitialize(conf, resourceManager.getRMContext()); QueueManager queueMgr = scheduler.getQueueManager(); FSQueue queue2 = queueMgr.getLeafQueue("queue2", true); queue2.setMaxRunningApps(0); ApplicationAttemptId appAttId = createSchedulingRequest(1024, 1, "queue1", "user1", 3); scheduler.moveApplication(appAttId.getApplicationId(), "queue2"); }