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;
}
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;
}
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();
}
}
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());
}
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();
}
}
Aggregations