Search in sources :

Example 6 with SchedulingPlacementSet

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

Example 7 with SchedulingPlacementSet

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();
    }
}
Also used : 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)

Example 8 with SchedulingPlacementSet

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();
    }
}
Also used : SchedulingPlacementSet(org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.SchedulingPlacementSet)

Aggregations

SchedulingPlacementSet (org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.SchedulingPlacementSet)8 LocalitySchedulingPlacementSet (org.apache.hadoop.yarn.server.resourcemanager.scheduler.placement.LocalitySchedulingPlacementSet)6 PendingAsk (org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.PendingAsk)2 Resource (org.apache.hadoop.yarn.api.records.Resource)1 SchedulerRequestKey (org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey)1