Search in sources :

Example 56 with FiCaSchedulerNode

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

the class LeafQueue method attachContainer.

@Override
public void attachContainer(Resource clusterResource, FiCaSchedulerApp application, RMContainer rmContainer) {
    if (application != null && rmContainer != null && rmContainer.getExecutionType() == ExecutionType.GUARANTEED) {
        FiCaSchedulerNode node = scheduler.getNode(rmContainer.getContainer().getNodeId());
        allocateResource(clusterResource, application, rmContainer.getContainer().getResource(), node.getPartition(), rmContainer);
        LOG.info("movedContainer" + " container=" + rmContainer.getContainer() + " resource=" + rmContainer.getContainer().getResource() + " queueMoveIn=" + this + " usedCapacity=" + getUsedCapacity() + " absoluteUsedCapacity=" + getAbsoluteUsedCapacity() + " used=" + queueUsage.getUsed() + " cluster=" + clusterResource);
        // Inform the parent queue
        getParent().attachContainer(clusterResource, application, rmContainer);
    }
}
Also used : FiCaSchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode)

Example 57 with FiCaSchedulerNode

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

the class LeafQueue method recoverContainer.

@Override
public void recoverContainer(Resource clusterResource, SchedulerApplicationAttempt attempt, RMContainer rmContainer) {
    if (rmContainer.getState().equals(RMContainerState.COMPLETED)) {
        return;
    }
    // Careful! Locking order is important!
    try {
        writeLock.lock();
        FiCaSchedulerNode node = scheduler.getNode(rmContainer.getContainer().getNodeId());
        allocateResource(clusterResource, attempt, rmContainer.getContainer().getResource(), node.getPartition(), rmContainer);
    } finally {
        writeLock.unlock();
    }
    getParent().recoverContainer(clusterResource, attempt, rmContainer);
}
Also used : FiCaSchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode)

Example 58 with FiCaSchedulerNode

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

the class ParentQueue method detachContainer.

@Override
public void detachContainer(Resource clusterResource, FiCaSchedulerApp application, RMContainer rmContainer) {
    if (application != null) {
        FiCaSchedulerNode node = scheduler.getNode(rmContainer.getContainer().getNodeId());
        super.releaseResource(clusterResource, rmContainer.getContainer().getResource(), node.getPartition());
        LOG.info("movedContainer" + " queueMoveOut=" + getQueueName() + " usedCapacity=" + getUsedCapacity() + " absoluteUsedCapacity=" + getAbsoluteUsedCapacity() + " used=" + queueUsage.getUsed() + " cluster=" + clusterResource);
        // Inform the parent
        if (parent != null) {
            parent.detachContainer(clusterResource, application, rmContainer);
        }
    }
}
Also used : FiCaSchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode)

Example 59 with FiCaSchedulerNode

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

the class ParentQueue method recoverContainer.

@Override
public void recoverContainer(Resource clusterResource, SchedulerApplicationAttempt attempt, RMContainer rmContainer) {
    if (rmContainer.getState().equals(RMContainerState.COMPLETED)) {
        return;
    }
    // Careful! Locking order is important!
    try {
        writeLock.lock();
        FiCaSchedulerNode node = scheduler.getNode(rmContainer.getContainer().getNodeId());
        allocateResource(clusterResource, rmContainer.getContainer().getResource(), node.getPartition());
    } finally {
        writeLock.unlock();
    }
    if (parent != null) {
        parent.recoverContainer(clusterResource, attempt, rmContainer);
    }
}
Also used : FiCaSchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode)

Example 60 with FiCaSchedulerNode

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

the class ProportionalCapacityPreemptionPolicyMockFramework method mockSchedulerNodes.

/**
   * Format is:
   * host1=partition[ res=resource];
   * host2=partition[ res=resource];
   */
private void mockSchedulerNodes(String schedulerNodesConfigStr) throws IOException {
    String[] nodesConfigStrArray = schedulerNodesConfigStr.split(";");
    for (String p : nodesConfigStrArray) {
        String[] arr = p.split(" ");
        NodeId nodeId = NodeId.newInstance(arr[0].substring(0, arr[0].indexOf("=")), 1);
        String partition = arr[0].substring(arr[0].indexOf("=") + 1, arr[0].length());
        FiCaSchedulerNode sn = mock(FiCaSchedulerNode.class);
        when(sn.getNodeID()).thenReturn(nodeId);
        when(sn.getPartition()).thenReturn(partition);
        Resource totalRes = Resources.createResource(0);
        if (arr.length > 1) {
            String res = arr[1];
            if (res.contains("res=")) {
                String resSring = res.substring(res.indexOf("res=") + "res=".length());
                totalRes = parseResourceFromString(resSring);
            }
        }
        when(sn.getTotalResource()).thenReturn(totalRes);
        when(sn.getUnallocatedResource()).thenReturn(Resources.clone(totalRes));
        // TODO, add settings of killable resources when necessary
        when(sn.getTotalKillableResources()).thenReturn(Resources.none());
        List<RMContainer> liveContainers = new ArrayList<>();
        when(sn.getCopiedListOfRunningContainers()).thenReturn(liveContainers);
        nodeIdToSchedulerNodes.put(nodeId, sn);
        LOG.debug("add scheduler node, id=" + nodeId + ", partition=" + partition);
    }
}
Also used : FiCaSchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode) NodeId(org.apache.hadoop.yarn.api.records.NodeId) Resource(org.apache.hadoop.yarn.api.records.Resource) ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) RMContainer(org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer)

Aggregations

FiCaSchedulerNode (org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode)79 FiCaSchedulerApp (org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp)47 Resource (org.apache.hadoop.yarn.api.records.Resource)46 Test (org.junit.Test)39 ResourceLimits (org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceLimits)37 NodeId (org.apache.hadoop.yarn.api.records.NodeId)35 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)34 Priority (org.apache.hadoop.yarn.api.records.Priority)34 RMContainer (org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer)21 ActiveUsersManager (org.apache.hadoop.yarn.server.resourcemanager.scheduler.ActiveUsersManager)20 ArrayList (java.util.ArrayList)14 RMApp (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp)11 ResourceRequest (org.apache.hadoop.yarn.api.records.ResourceRequest)10 SchedulerRequestKey (org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey)9 HashMap (java.util.HashMap)8 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)7 AMState (org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt.AMState)7 Container (org.apache.hadoop.yarn.api.records.Container)6 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)5 RMContext (org.apache.hadoop.yarn.server.resourcemanager.RMContext)5