Search in sources :

Example 6 with PendingAsk

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk in project hadoop by apache.

the class FifoScheduler method assignNodeLocalContainers.

private int assignNodeLocalContainers(FiCaSchedulerNode node, FifoAppAttempt application, SchedulerRequestKey schedulerKey) {
    int assignedContainers = 0;
    PendingAsk nodeLocalAsk = application.getPendingAsk(schedulerKey, node.getNodeName());
    if (nodeLocalAsk.getCount() > 0) {
        // Don't allocate on this node if we don't need containers on this rack
        if (application.getOutstandingAsksCount(schedulerKey, node.getRackName()) <= 0) {
            return 0;
        }
        int assignableContainers = Math.min(getMaxAllocatableContainers(application, schedulerKey, node, NodeType.NODE_LOCAL), nodeLocalAsk.getCount());
        assignedContainers = assignContainer(node, application, schedulerKey, assignableContainers, nodeLocalAsk.getPerAllocationResource(), NodeType.NODE_LOCAL);
    }
    return assignedContainers;
}
Also used : PendingAsk(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk)

Example 7 with PendingAsk

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk in project hadoop by apache.

the class FifoScheduler method assignOffSwitchContainers.

private int assignOffSwitchContainers(FiCaSchedulerNode node, FifoAppAttempt application, SchedulerRequestKey schedulerKey) {
    int assignedContainers = 0;
    PendingAsk offswitchAsk = application.getPendingAsk(schedulerKey, ResourceRequest.ANY);
    if (offswitchAsk.getCount() > 0) {
        assignedContainers = assignContainer(node, application, schedulerKey, offswitchAsk.getCount(), offswitchAsk.getPerAllocationResource(), NodeType.OFF_SWITCH);
    }
    return assignedContainers;
}
Also used : PendingAsk(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk)

Example 8 with PendingAsk

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk in project hadoop by apache.

the class LocalitySchedulingPlacementSet method getPendingAsk.

@Override
public PendingAsk getPendingAsk(String resourceName) {
    try {
        readLock.lock();
        ResourceRequest request = getResourceRequest(resourceName);
        if (null == request) {
            return PendingAsk.ZERO;
        } else {
            return new PendingAsk(request.getCapability(), request.getNumContainers());
        }
    } finally {
        readLock.unlock();
    }
}
Also used : ResourceRequest(org.apache.hadoop.yarn.api.records.ResourceRequest) PendingAsk(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk)

Example 9 with PendingAsk

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk in project hadoop by apache.

the class TestNodeLabelContainerAllocation method checkPendingResource.

private void checkPendingResource(MockRM rm, int priority, ApplicationAttemptId attemptId, int memory) {
    CapacityScheduler cs = (CapacityScheduler) rm.getRMContext().getScheduler();
    FiCaSchedulerApp app = cs.getApplicationAttempt(attemptId);
    PendingAsk ask = app.getAppSchedulingInfo().getPendingAsk(TestUtils.toSchedulerKey(priority), "*");
    Assert.assertEquals(memory, ask.getPerAllocationResource().getMemorySize() * ask.getCount());
}
Also used : FiCaSchedulerApp(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp) PendingAsk(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk)

Example 10 with PendingAsk

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk in project hadoop by apache.

the class AppSchedulingInfo method move.

public void move(Queue newQueue) {
    try {
        this.writeLock.lock();
        QueueMetrics oldMetrics = queue.getMetrics();
        QueueMetrics newMetrics = newQueue.getMetrics();
        for (SchedulingPlacementSet ps : schedulerKeyToPlacementSets.values()) {
            PendingAsk ask = ps.getPendingAsk(ResourceRequest.ANY);
            if (ask.getCount() > 0) {
                oldMetrics.decrPendingResources(user, ask.getCount(), ask.getPerAllocationResource());
                newMetrics.incrPendingResources(user, ask.getCount(), ask.getPerAllocationResource());
                Resource delta = Resources.multiply(ask.getPerAllocationResource(), ask.getCount());
                // Update Queue
                queue.decPendingResource(ps.getPrimaryRequestedNodePartition(), delta);
                newQueue.incPendingResource(ps.getPrimaryRequestedNodePartition(), delta);
            }
        }
        oldMetrics.moveAppFrom(this);
        newMetrics.moveAppTo(this);
        abstractUsersManager.deactivateApplication(user, applicationId);
        abstractUsersManager = newQueue.getAbstractUsersManager();
        abstractUsersManager.activateApplication(user, applicationId);
        this.queue = newQueue;
    } finally {
        this.writeLock.unlock();
    }
}
Also used : Resource(org.apache.hadoop.yarn.api.records.Resource) LocalitySchedulingPlacementSet(org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.LocalitySchedulingPlacementSet) SchedulingPlacementSet(org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.SchedulingPlacementSet) PendingAsk(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk)

Aggregations

PendingAsk (org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk)15 Resource (org.apache.hadoop.yarn.api.records.Resource)4 SchedulerRequestKey (org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey)3 Priority (org.apache.hadoop.yarn.api.records.Priority)2 NodeType (org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType)2 LocalitySchedulingPlacementSet (org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.LocalitySchedulingPlacementSet)2 SchedulingPlacementSet (org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.SchedulingPlacementSet)2 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ResourceRequest (org.apache.hadoop.yarn.api.records.ResourceRequest)1 FiCaSchedulerApp (org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp)1 FiCaSchedulerNode (org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode)1