@Test (timeout = 5000) public void test() throws Exception { conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE); PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE)); out.println("<?xml version=\"1.0\"?>"); out.println("<allocations>"); out.println("<queue name=\"queueA\">"); out.println("<minResources>2048mb,0vcores</minResources>"); out.println("</queue>"); out.println("<queue name=\"queueB\">"); out.println("<minResources>2048mb,0vcores</minResources>"); out.println("</queue>"); out.println("</allocations>"); out.close(); resourceManager = new MockRM(conf); resourceManager.start(); scheduler = (FairScheduler) resourceManager.getResourceScheduler(); RMNode node1 = MockNodes.newNodeInfo(1, Resources.createResource(4 * 1024, 4), 1, "127.0.0.1"); NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1); scheduler.handle(nodeEvent1); scheduler.update(); createSchedulingRequest(3 * 1024, "queueA", "user1"); scheduler.update(); NodeUpdateSchedulerEvent nodeEvent2 = new NodeUpdateSchedulerEvent(node1); scheduler.handle(nodeEvent2); createSchedulingRequest(1 * 1024, "queueB", "user1"); scheduler.update(); Collection<FSLeafQueue> queues = scheduler.getQueueManager().getLeafQueues(); assertEquals(3, queues.size()); FSLeafQueue queueA = scheduler.getQueueManager().getLeafQueue("queueA", false); FSLeafQueue queueB = scheduler.getQueueManager().getLeafQueue("queueB", false); assertFalse(queueA.isStarvedForMinShare()); assertTrue(queueB.isStarvedForMinShare()); scheduler.handle(nodeEvent2); assertFalse(queueB.isStarvedForMinShare()); }
@VisibleForTesting boolean isStarvedForMinShare() { return isStarved(getMinShare()); }
FSLeafQueue extends FSQueue { @VisibleForTesting boolean isStarvedForMinShare() { return isStarved(getMinShare()); } }
FSLeafQueue extends FSQueue { @VisibleForTesting boolean isStarvedForMinShare() { return isStarved(getMinShare()); } FSLeafQueue(String name, FairScheduler scheduler,
      FSParentQueue parent); }
FSLeafQueue extends FSQueue { @VisibleForTesting boolean isStarvedForMinShare() { return isStarved(getMinShare()); } FSLeafQueue(String name, FairScheduler scheduler,
      FSParentQueue parent); void addApp(FSAppAttempt app, boolean runnable); boolean removeApp(FSAppAttempt app); boolean removeNonRunnableApp(FSAppAttempt app); boolean isRunnableApp(FSAppAttempt attempt); boolean isNonRunnableApp(FSAppAttempt attempt); void resetPreemptedResources(); void clearPreemptedResources(); List<FSAppAttempt> getCopyOfNonRunnableAppSchedulables(); @Override void collectSchedulerApplications(
      Collection<ApplicationAttemptId> apps); @Override void setPolicy(SchedulingPolicy policy); @Override void recomputeShares(); @Override Resource getDemand(); @Override Resource getResourceUsage(); Resource getAmResourceUsage(); @Override void updateDemand(); @Override Resource assignContainer(FSSchedulerNode node); @Override RMContainer preemptContainer(); @Override List<FSQueue> getChildQueues(); @Override List<QueueUserACLInfo> getQueueUserAclInfo(UserGroupInformation user); long getLastTimeAtMinShare(); long getLastTimeAtFairShareThreshold(); @Override int getNumRunnableApps(); int getNumNonRunnableApps(); int getNumPendingApps(); int getNumActiveApps(); @Override ActiveUsersManager getActiveUsersManager(); boolean canRunAppAM(Resource amResource); void addAMResourceUsage(Resource amResource); @Override void recoverContainer(Resource clusterResource,
      SchedulerApplicationAttempt schedulerAttempt, RMContainer rmContainer); void updateStarvationStats(); }
FSLeafQueue extends FSQueue { @VisibleForTesting boolean isStarvedForMinShare() { return isStarved(getMinShare()); } FSLeafQueue(String name, FairScheduler scheduler,
      FSParentQueue parent); void addApp(FSAppAttempt app, boolean runnable); boolean removeApp(FSAppAttempt app); boolean removeNonRunnableApp(FSAppAttempt app); boolean isRunnableApp(FSAppAttempt attempt); boolean isNonRunnableApp(FSAppAttempt attempt); void resetPreemptedResources(); void clearPreemptedResources(); List<FSAppAttempt> getCopyOfNonRunnableAppSchedulables(); @Override void collectSchedulerApplications(
      Collection<ApplicationAttemptId> apps); @Override void setPolicy(SchedulingPolicy policy); @Override void recomputeShares(); @Override Resource getDemand(); @Override Resource getResourceUsage(); Resource getAmResourceUsage(); @Override void updateDemand(); @Override Resource assignContainer(FSSchedulerNode node); @Override RMContainer preemptContainer(); @Override List<FSQueue> getChildQueues(); @Override List<QueueUserACLInfo> getQueueUserAclInfo(UserGroupInformation user); long getLastTimeAtMinShare(); long getLastTimeAtFairShareThreshold(); @Override int getNumRunnableApps(); int getNumNonRunnableApps(); int getNumPendingApps(); int getNumActiveApps(); @Override ActiveUsersManager getActiveUsersManager(); boolean canRunAppAM(Resource amResource); void addAMResourceUsage(Resource amResource); @Override void recoverContainer(Resource clusterResource,
      SchedulerApplicationAttempt schedulerAttempt, RMContainer rmContainer); void updateStarvationStats();  }