private FSQueue getQueue(String name, boolean create, FSQueueType queueType) { name = ensureRootPrefix(name); synchronized (queues) { FSQueue queue = queues.get(name); if (queue == null && create) { // if the queue doesn't exist,create it and return queue = createQueue(name, queueType); // Update steady fair share for all queues if (queue != null) { rootQueue.recomputeSteadyShares(); } } return queue; } }
private FSQueue getQueue(String name, boolean create, FSQueueType queueType) { name = ensureRootPrefix(name); synchronized (queues) { FSQueue queue = queues.get(name); if (queue == null && create) { // if the queue doesn't exist,create it and return queue = createQueue(name, queueType); // Update steady fair share for all queues if (queue != null) { rootQueue.recomputeSteadyShares(); } } return queue; } }
private FSQueue getQueue(String name, boolean create, FSQueueType queueType, boolean recomputeSteadyShares, ApplicationId applicationId) { boolean recompute = recomputeSteadyShares; name = ensureRootPrefix(name); FSQueue queue; synchronized (queues) { queue = queues.get(name); if (queue == null && create) { // if the queue doesn't exist,create it and return queue = createQueue(name, queueType); } else { recompute = false; } // At this point the queue exists and we need to assign the app if to the // but only to a leaf queue if (applicationId != null && queue instanceof FSLeafQueue) { ((FSLeafQueue)queue).addAssignedApp(applicationId); } } // Don't recompute if it is an existing queue or no change was made if (recompute && queue != null) { rootQueue.recomputeSteadyShares(); } return queue; }
/** * Test creation of a simple parent queue. */ @Test public void testCreateParentQueue() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); FSQueue q1 = queueManager.createQueue("root.queue1", FSQueueType.PARENT); assertNotNull("Parent queue root.queue1 was not created", queueManager.getParentQueue("root.queue1", false)); assertEquals("createQueue() returned wrong queue", "root.queue1", q1.getName()); }
/** * 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 creation of a leaf queue and its parent. */ @Test public void testCreateLeafQueueAndParent() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); FSQueue q2 = queueManager.createQueue("root.queue1.queue2", FSQueueType.LEAF); assertNotNull("Parent queue root.queue1 was not created", queueManager.getParentQueue("root.queue1", false)); assertNotNull("Leaf queue root.queue1.queue2 was not created", queueManager.getLeafQueue("root.queue1.queue2", false)); assertEquals("createQueue() returned wrong queue", "root.queue1.queue2", q2.getName()); }
/** * Test creation of a parent queue and its parent. */ @Test public void testCreateParentQueueAndParent() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); FSQueue q2 = queueManager.createQueue("root.queue1.queue2", FSQueueType.PARENT); assertNotNull("Parent queue root.queue1 was not created", queueManager.getParentQueue("root.queue1", false)); assertNotNull("Leaf queue root.queue1.queue2 was not created", queueManager.getParentQueue("root.queue1.queue2", false)); assertEquals("createQueue() returned wrong queue", "root.queue1.queue2", q2.getName()); }
/** * Test creation of a leaf queue with no resource limits. */ @Test public void testCreateLeafQueueWithDefaults() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); 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()); // Min default is 0,0 assertEquals("Min resources were not set to default", Resources.createResource(0, 0), q1.getMinShare()); // Max default is unbounded assertEquals("Max resources were not set to default", Resources.unbounded(), q1.getMaxShare()); }
new ConfigurableResource(Resources.createResource(8192, 256))); FSQueue q1 = queueManager.createQueue("root.test.childC", FSQueueType.LEAF); assertNotNull("Leaf queue root.test.childC was not created", queueManager.getLeafQueue("root.test.childC", false)); q1.getMaxShare()); FSQueue q2 = queueManager.createQueue("root.test.childD", FSQueueType.PARENT);