use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.SchedulingPlacementSet 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();
}
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.SchedulingPlacementSet in project hadoop by apache.
the class AppSchedulingInfo method stop.
public void stop() {
// clear pending resources metrics for the application
try {
this.writeLock.lock();
QueueMetrics metrics = queue.getMetrics();
for (SchedulingPlacementSet ps : schedulerKeyToPlacementSets.values()) {
PendingAsk ask = ps.getPendingAsk(ResourceRequest.ANY);
if (ask.getCount() > 0) {
metrics.decrPendingResources(user, ask.getCount(), ask.getPerAllocationResource());
// Update Queue
queue.decPendingResource(ps.getPrimaryRequestedNodePartition(), Resources.multiply(ask.getPerAllocationResource(), ask.getCount()));
}
}
metrics.finishAppAttempt(applicationId, pending, user);
// Clear requests themselves
clearRequests();
} finally {
this.writeLock.unlock();
}
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.SchedulingPlacementSet in project hadoop by apache.
the class SchedulerApplicationAttempt method getOutstandingAsksCount.
public int getOutstandingAsksCount(SchedulerRequestKey schedulerKey, String resourceName) {
try {
readLock.lock();
SchedulingPlacementSet ps = appSchedulingInfo.getSchedulingPlacementSet(schedulerKey);
return ps == null ? 0 : ps.getOutstandingAsksCount(resourceName);
} finally {
readLock.unlock();
}
}
Aggregations