Search in sources :

Example 1 with ResourceRequestUpdateResult

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.ResourceRequestUpdateResult in project hadoop by apache.

the class AppSchedulingInfo method addToPlacementSets.

boolean addToPlacementSets(boolean recoverPreemptedRequestForAContainer, Map<SchedulerRequestKey, Map<String, ResourceRequest>> dedupRequests) {
    boolean offswitchResourcesUpdated = false;
    for (Map.Entry<SchedulerRequestKey, Map<String, ResourceRequest>> entry : dedupRequests.entrySet()) {
        SchedulerRequestKey schedulerRequestKey = entry.getKey();
        if (!schedulerKeyToPlacementSets.containsKey(schedulerRequestKey)) {
            schedulerKeyToPlacementSets.put(schedulerRequestKey, new LocalitySchedulingPlacementSet<>(this));
        }
        // Update placement set
        ResourceRequestUpdateResult pendingAmountChanges = schedulerKeyToPlacementSets.get(schedulerRequestKey).updateResourceRequests(entry.getValue().values(), recoverPreemptedRequestForAContainer);
        if (null != pendingAmountChanges) {
            updatePendingResources(pendingAmountChanges.getLastAnyResourceRequest(), pendingAmountChanges.getNewResourceRequest(), schedulerRequestKey, queue.getMetrics());
            offswitchResourcesUpdated = true;
        }
    }
    return offswitchResourcesUpdated;
}
Also used : ResourceRequestUpdateResult(org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.ResourceRequestUpdateResult) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap) TreeMap(java.util.TreeMap) SchedulerRequestKey(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)1 ResourceRequestUpdateResult (org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.ResourceRequestUpdateResult)1 SchedulerRequestKey (org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey)1