Search in sources :

Example 1 with FSQueue

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue in project hadoop by apache.

the class FairSchedulerPlanFollower method getChildReservationQueues.

@Override
protected List<? extends Queue> getChildReservationQueues(Queue queue) {
    FSQueue planQueue = (FSQueue) queue;
    List<FSQueue> childQueues = planQueue.getChildQueues();
    return childQueues;
}
Also used : FSQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue)

Example 2 with FSQueue

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue in project hadoop by apache.

the class TestFairSchedulerQueueInfo method testEmptyChildQueues.

@Test
public void testEmptyChildQueues() throws Exception {
    FairSchedulerConfiguration conf = new FairSchedulerConfiguration();
    FairScheduler scheduler = mock(FairScheduler.class);
    AllocationConfiguration allocConf = new AllocationConfiguration(conf);
    when(scheduler.getAllocationConfiguration()).thenReturn(allocConf);
    when(scheduler.getConf()).thenReturn(conf);
    when(scheduler.getClusterResource()).thenReturn(Resource.newInstance(1, 1));
    SystemClock clock = SystemClock.getInstance();
    when(scheduler.getClock()).thenReturn(clock);
    QueueManager queueManager = new QueueManager(scheduler);
    queueManager.initialize(conf);
    FSQueue testQueue = queueManager.getLeafQueue("test", true);
    FairSchedulerQueueInfo queueInfo = new FairSchedulerQueueInfo(testQueue, scheduler);
    Collection<FairSchedulerQueueInfo> childQueues = queueInfo.getChildQueues();
    Assert.assertNotNull(childQueues);
    Assert.assertEquals("Child QueueInfo was not empty", 0, childQueues.size());
}
Also used : FairSchedulerConfiguration(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration) FairScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler) SystemClock(org.apache.hadoop.yarn.util.SystemClock) FSQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue) AllocationConfiguration(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfiguration) QueueManager(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.QueueManager) Test(org.junit.Test)

Example 3 with FSQueue

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue in project hadoop by apache.

the class ComputeFairShares method handleFixedFairShares.

/**
   * Helper method to handle Schedulabes with fixed fairshares.
   * Returns the resources taken by fixed fairshare schedulables,
   * and adds the remaining to the passed nonFixedSchedulables.
   */
private static int handleFixedFairShares(Collection<? extends Schedulable> schedulables, Collection<Schedulable> nonFixedSchedulables, boolean isSteadyShare, ResourceType type) {
    int totalResource = 0;
    for (Schedulable sched : schedulables) {
        long fixedShare = getFairShareIfFixed(sched, isSteadyShare, type);
        if (fixedShare < 0) {
            nonFixedSchedulables.add(sched);
        } else {
            setResourceValue(fixedShare, isSteadyShare ? ((FSQueue) sched).getSteadyFairShare() : sched.getFairShare(), type);
            totalResource = (int) Math.min((long) totalResource + (long) fixedShare, Integer.MAX_VALUE);
        }
    }
    return totalResource;
}
Also used : FSQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue) Schedulable(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.Schedulable)

Example 4 with FSQueue

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue in project hadoop by apache.

the class FairSchedulerQueueInfo method getChildQueues.

protected FairSchedulerQueueInfoList getChildQueues(FSQueue queue, FairScheduler scheduler) {
    // Return null to omit 'childQueues' field from the return value of
    // REST API if it is empty. We omit the field to keep the consistency
    // with CapacitySchedulerQueueInfo, which omits 'queues' field if empty.
    Collection<FSQueue> children = queue.getChildQueues();
    if (children.isEmpty()) {
        return null;
    }
    FairSchedulerQueueInfoList list = new FairSchedulerQueueInfoList();
    for (FSQueue child : children) {
        if (child instanceof FSLeafQueue) {
            list.addToQueueInfoList(new FairSchedulerLeafQueueInfo((FSLeafQueue) child, scheduler));
        } else {
            list.addToQueueInfoList(new FairSchedulerQueueInfo(child, scheduler));
        }
    }
    return list;
}
Also used : FSLeafQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue) FSQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue)

Example 5 with FSQueue

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue in project hadoop by apache.

the class FairSchedulerMetrics method trackQueue.

@Override
public void trackQueue(String queueName) {
    trackedQueues.add(queueName);
    FairScheduler fair = (FairScheduler) scheduler;
    final FSQueue queue = fair.getQueueManager().getQueue(queueName);
    metrics.register("variable.queue." + queueName + ".demand.memory", new Gauge<Long>() {

        @Override
        public Long getValue() {
            return queue.getDemand().getMemorySize();
        }
    });
    metrics.register("variable.queue." + queueName + ".demand.vcores", new Gauge<Integer>() {

        @Override
        public Integer getValue() {
            return queue.getDemand().getVirtualCores();
        }
    });
    metrics.register("variable.queue." + queueName + ".usage.memory", new Gauge<Long>() {

        @Override
        public Long getValue() {
            return queue.getResourceUsage().getMemorySize();
        }
    });
    metrics.register("variable.queue." + queueName + ".usage.vcores", new Gauge<Integer>() {

        @Override
        public Integer getValue() {
            return queue.getResourceUsage().getVirtualCores();
        }
    });
    metrics.register("variable.queue." + queueName + ".minshare.memory", new Gauge<Long>() {

        @Override
        public Long getValue() {
            return queue.getMinShare().getMemorySize();
        }
    });
    metrics.register("variable.queue." + queueName + ".minshare.vcores", new Gauge<Integer>() {

        @Override
        public Integer getValue() {
            return queue.getMinShare().getVirtualCores();
        }
    });
    metrics.register("variable.queue." + queueName + ".maxshare.memory", new Gauge<Long>() {

        @Override
        public Long getValue() {
            if (!maxReset && SLSRunner.simulateInfoMap.containsKey("Number of nodes") && SLSRunner.simulateInfoMap.containsKey("Node memory (MB)") && SLSRunner.simulateInfoMap.containsKey("Node VCores")) {
                int numNMs = Integer.parseInt(SLSRunner.simulateInfoMap.get("Number of nodes").toString());
                int numMemoryMB = Integer.parseInt(SLSRunner.simulateInfoMap.get("Node memory (MB)").toString());
                int numVCores = Integer.parseInt(SLSRunner.simulateInfoMap.get("Node VCores").toString());
                totalMemoryMB = numNMs * numMemoryMB;
                totalVCores = numNMs * numVCores;
                maxReset = false;
            }
            return Math.min(queue.getMaxShare().getMemorySize(), totalMemoryMB);
        }
    });
    metrics.register("variable.queue." + queueName + ".maxshare.vcores", new Gauge<Integer>() {

        @Override
        public Integer getValue() {
            return Math.min(queue.getMaxShare().getVirtualCores(), totalVCores);
        }
    });
    metrics.register("variable.queue." + queueName + ".fairshare.memory", new Gauge<Long>() {

        @Override
        public Long getValue() {
            return queue.getFairShare().getMemorySize();
        }
    });
    metrics.register("variable.queue." + queueName + ".fairshare.vcores", new Gauge<Integer>() {

        @Override
        public Integer getValue() {
            return queue.getFairShare().getVirtualCores();
        }
    });
}
Also used : FairScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler) FSQueue(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue)

Aggregations

FSQueue (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue)5 FairScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler)2 AllocationConfiguration (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfiguration)1 FSLeafQueue (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue)1 FairSchedulerConfiguration (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration)1 QueueManager (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.QueueManager)1 Schedulable (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.Schedulable)1 SystemClock (org.apache.hadoop.yarn.util.SystemClock)1 Test (org.junit.Test)1