FairScheduler extends
    AbstractYarnScheduler<FSAppAttempt, FSSchedulerNode> { @Override public Resource getMaximumResourceCapability(String queueName) { if(queueName == null || queueName.isEmpty()) { return getMaximumResourceCapability(); } FSQueue queue = queueMgr.getQueue(queueName); Resource schedulerLevelMaxResourceCapability = getMaximumResourceCapability(); if (queue == null) { return schedulerLevelMaxResourceCapability; } Resource queueMaxResourceCapability = queue.getMaximumContainerAllocation(); if (queueMaxResourceCapability.equals(Resources.unbounded())) { return schedulerLevelMaxResourceCapability; } else { return Resources.componentwiseMin(schedulerLevelMaxResourceCapability, queueMaxResourceCapability); } } FairScheduler(); FSContext getContext(); boolean isAtLeastReservationThreshold(
      ResourceCalculator resourceCalculator, Resource resource); FairSchedulerConfiguration getConf(); int getNumNodesInRack(String rackName); QueueManager getQueueManager(); @VisibleForTesting @Override void update(); RMContainerTokenSecretManager getContainerTokenSecretManager(); boolean isSizeBasedWeight(); Resource getIncrementResourceCapability(); double getNodeLocalityThreshold(); double getRackLocalityThreshold(); @Deprecated long getNodeLocalityDelayMs(); @Deprecated long getRackLocalityDelayMs(); @Deprecated boolean isContinuousSchedulingEnabled(); @Deprecated int getContinuousSchedulingSleepMs(); @Override Resource getNormalizedResource(Resource requestedResource,
      Resource maxResourceCapability); @Override Resource getMaximumResourceCapability(String queueName); @VisibleForTesting @Override void killContainer(RMContainer container); @Override Allocation allocate(ApplicationAttemptId appAttemptId,
      List<ResourceRequest> ask, List<SchedulingRequest> schedulingRequests,
      List<ContainerId> release, List<String> blacklistAdditions,
      List<String> blacklistRemovals, ContainerUpdates updateRequests); FSAppAttempt getSchedulerApp(ApplicationAttemptId appAttemptId); @Override ResourceCalculator getResourceCalculator(); @Override QueueMetrics getRootQueueMetrics(); @Override void handle(SchedulerEvent event); @Override void recover(RMState state); void setRMContext(RMContext rmContext); @Override void serviceInit(Configuration conf); @Override void serviceStart(); @SuppressWarnings("deprecation") @Override void serviceStop(); @Override void reinitialize(Configuration conf, RMContext rmContext); @Override QueueInfo getQueueInfo(String queueName, boolean includeChildQueues,
      boolean recursive); @Override List<QueueUserACLInfo> getQueueUserAclInfo(); @Override int getNumClusterNodes(); @Override boolean checkAccess(UserGroupInformation callerUGI,
      QueueACL acl, String queueName); AllocationConfiguration getAllocationConfiguration(); @Override List<ApplicationAttemptId> getAppsInQueue(String queueName); @Override String moveApplication(ApplicationId appId,
      String queueName); @Override void preValidateMoveApplication(ApplicationId appId, String newQueue); @Override void updateNodeResource(RMNode nm,
      ResourceOption resourceOption); @Override EnumSet<SchedulerResourceTypes> getSchedulingResourceTypes(); @Override Set<String> getPlanQueues(); @Override void setEntitlement(String queueName,
      QueueEntitlement entitlement); @Override void removeQueue(String queueName); float getReservableNodesRatio(); @Override long checkAndGetApplicationLifetime(String queueName, long lifetime); static final Resource CONTAINER_RESERVED; }
@Test public void testQueueMaximumCapacityAllocations() throws IOException { conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE); int tooHighQueueAllocation = RM_SCHEDULER_MAXIMUM_ALLOCATION_MB_VALUE +1; PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE)); out.println("<?xml version=\"1.0\"?>"); out.println("<allocations>"); out.println(" <queue name=\"queueA\">"); out.println( " <maxContainerAllocation>512 mb 1 vcores</maxContainerAllocation>"); out.println(" </queue>"); out.println(" <queue name=\"queueB\">"); out.println(" </queue>"); out.println(" <queue name=\"queueC\">"); out.println( " <maxContainerAllocation>2048 mb 3 vcores</maxContainerAllocation>"); out.println(" <queue name=\"queueD\">"); out.println(" </queue>"); out.println(" </queue>"); out.println(" <queue name=\"queueE\">"); out.println(" <maxContainerAllocation>" + tooHighQueueAllocation + " mb 1 vcores</maxContainerAllocation>"); out.println(" </queue>"); out.println("</allocations>"); out.close(); scheduler.init(conf); Assert.assertEquals(1, scheduler.getMaximumResourceCapability("root.queueA") .getVirtualCores()); Assert.assertEquals(512, scheduler.getMaximumResourceCapability("root.queueA").getMemorySize()); Assert.assertEquals(DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, scheduler.getMaximumResourceCapability("root.queueB") .getVirtualCores()); Assert.assertEquals(RM_SCHEDULER_MAXIMUM_ALLOCATION_MB_VALUE, scheduler.getMaximumResourceCapability("root.queueB").getMemorySize()); Assert.assertEquals(3, scheduler.getMaximumResourceCapability("root.queueC") .getVirtualCores()); Assert.assertEquals(2048, scheduler.getMaximumResourceCapability("root.queueC").getMemorySize()); Assert.assertEquals(3, scheduler .getMaximumResourceCapability("root.queueC.queueD").getVirtualCores()); Assert.assertEquals(2048, scheduler .getMaximumResourceCapability("root.queueC.queueD").getMemorySize()); Assert.assertEquals(RM_SCHEDULER_MAXIMUM_ALLOCATION_MB_VALUE, scheduler .getMaximumResourceCapability("root.queueE").getMemorySize()); }