private boolean isReservable(Resource capacity) { // Reserve only when the app is starved and the requested container size // is larger than the configured threshold return isStarved() && scheduler.isAtLeastReservationThreshold( getQueue().getPolicy().getResourceCalculator(), capacity); }
/** * Remove apps that have their preemption requests fulfilled. */ private void cleanupPreemptionList() { // Synchronize separately to avoid potential deadlocks // This may cause delayed deletion of reservations LinkedList<FSAppAttempt> candidates; synchronized (this) { candidates = Lists.newLinkedList(resourcesPreemptedForApp.keySet()); } for (FSAppAttempt app : candidates) { if (app.isStopped() || !app.isStarved() || (Resources.isNone(app.getFairshareStarvation()) && Resources.isNone(app.getMinshareStarvation()))) { // App does not need more resources synchronized (this) { Resource removed = resourcesPreemptedForApp.remove(app); if (removed != null) { Resources.subtractFrom(totalResourcesPreempted, removed); appIdToAppMap.remove(app.getApplicationAttemptId()); } } } } }
when(starvingApp.isStarved()).thenAnswer( new Answer<Boolean>() { @Override