Search in sources :

Example 1 with KillableContainer

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.preemption.KillableContainer in project hadoop by apache.

the class LeafQueue method completedContainer.

@Override
public void completedContainer(Resource clusterResource, FiCaSchedulerApp application, FiCaSchedulerNode node, RMContainer rmContainer, ContainerStatus containerStatus, RMContainerEventType event, CSQueue childQueue, boolean sortQueues) {
    // Update SchedulerHealth for released / preempted container
    updateSchedulerHealthForCompletedContainer(rmContainer, containerStatus);
    if (application != null) {
        boolean removed = false;
        // Careful! Locking order is important!
        try {
            writeLock.lock();
            Container container = rmContainer.getContainer();
            // So, this is, in effect, a transaction across application & node
            if (rmContainer.getState() == RMContainerState.RESERVED) {
                removed = application.unreserve(rmContainer.getReservedSchedulerKey(), node, rmContainer);
            } else {
                removed = application.containerCompleted(rmContainer, containerStatus, event, node.getPartition());
                node.releaseContainer(rmContainer.getContainerId(), false);
            }
            // Book-keeping
            if (removed) {
                // Inform the ordering policy
                orderingPolicy.containerReleased(application, rmContainer);
                releaseResource(clusterResource, application, container.getResource(), node.getPartition(), rmContainer);
            }
        } finally {
            writeLock.unlock();
        }
        if (removed) {
            // Inform the parent queue _outside_ of the leaf-queue lock
            getParent().completedContainer(clusterResource, application, node, rmContainer, null, event, this, sortQueues);
        }
    }
    // Notify PreemptionManager
    csContext.getPreemptionManager().removeKillableContainer(new KillableContainer(rmContainer, node.getPartition(), queueName));
}
Also used : KillableContainer(org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.preemption.KillableContainer) SchedulerContainer(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.SchedulerContainer) KillableContainer(org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.preemption.KillableContainer) RMContainer(org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer) Container(org.apache.hadoop.yarn.api.records.Container)

Example 2 with KillableContainer

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.preemption.KillableContainer in project hadoop by apache.

the class CapacityScheduler method markContainerForKillable.

public void markContainerForKillable(RMContainer killableContainer) {
    try {
        writeLock.lock();
        if (LOG.isDebugEnabled()) {
            LOG.debug(SchedulerEventType.MARK_CONTAINER_FOR_KILLABLE + ": container" + killableContainer.toString());
        }
        if (!isLazyPreemptionEnabled) {
            super.completedContainer(killableContainer, SchedulerUtils.createPreemptedContainerStatus(killableContainer.getContainerId(), SchedulerUtils.PREEMPTED_CONTAINER), RMContainerEventType.KILL);
        } else {
            FiCaSchedulerNode node = (FiCaSchedulerNode) getSchedulerNode(killableContainer.getAllocatedNode());
            FiCaSchedulerApp application = getCurrentAttemptForContainer(killableContainer.getContainerId());
            node.markContainerToKillable(killableContainer.getContainerId());
            // Get the application for the finished container
            if (null != application) {
                String leafQueueName = application.getCSLeafQueue().getQueueName();
                getPreemptionManager().addKillableContainer(new KillableContainer(killableContainer, node.getPartition(), leafQueueName));
            }
        }
    } finally {
        writeLock.unlock();
    }
}
Also used : KillableContainer(org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.preemption.KillableContainer) FiCaSchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode) FiCaSchedulerApp(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp)

Example 3 with KillableContainer

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.preemption.KillableContainer in project hadoop by apache.

the class CapacityScheduler method markContainerForNonKillable.

private void markContainerForNonKillable(RMContainer nonKillableContainer) {
    try {
        writeLock.lock();
        if (LOG.isDebugEnabled()) {
            LOG.debug(SchedulerEventType.MARK_CONTAINER_FOR_NONKILLABLE + ": container" + nonKillableContainer.toString());
        }
        FiCaSchedulerNode node = (FiCaSchedulerNode) getSchedulerNode(nonKillableContainer.getAllocatedNode());
        FiCaSchedulerApp application = getCurrentAttemptForContainer(nonKillableContainer.getContainerId());
        node.markContainerToNonKillable(nonKillableContainer.getContainerId());
        // Get the application for the finished container
        if (null != application) {
            String leafQueueName = application.getCSLeafQueue().getQueueName();
            getPreemptionManager().removeKillableContainer(new KillableContainer(nonKillableContainer, node.getPartition(), leafQueueName));
        }
    } finally {
        writeLock.unlock();
    }
}
Also used : KillableContainer(org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.preemption.KillableContainer) FiCaSchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode) FiCaSchedulerApp(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp)

Aggregations

KillableContainer (org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.preemption.KillableContainer)3 FiCaSchedulerApp (org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp)2 FiCaSchedulerNode (org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode)2 Container (org.apache.hadoop.yarn.api.records.Container)1 RMContainer (org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer)1 SchedulerContainer (org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.SchedulerContainer)1