Search in sources :

Example 1 with AllocationConfiguration

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

the class TestFairSchedulerPlanFollower method setupPlanFollower.

private void setupPlanFollower() throws Exception {
    mClock = mock(Clock.class);
    mAgent = mock(ReservationAgent.class);
    String reservationQ = ReservationSystemTestUtil.getFullReservationQueueName();
    AllocationConfiguration allocConf = fs.getAllocationConfiguration();
    allocConf.setReservationWindow(20L);
    allocConf.setAverageCapacity(20);
    policy.init(reservationQ, allocConf);
}
Also used : ReservationAgent(org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent) AllocationConfiguration(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfiguration) Clock(org.apache.hadoop.yarn.util.Clock)

Example 2 with AllocationConfiguration

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfiguration 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 AllocationConfiguration

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

the class FairSchedulerShim method refreshDefaultQueue.

@Override
public void refreshDefaultQueue(Configuration conf, String userName) throws IOException {
    String requestedQueue = YarnConfiguration.DEFAULT_QUEUE_NAME;
    final AtomicReference<AllocationConfiguration> allocConf = new AtomicReference<AllocationConfiguration>();
    AllocationFileLoaderService allocsLoader = new AllocationFileLoaderService();
    allocsLoader.init(conf);
    allocsLoader.setReloadListener(new AllocationFileLoaderService.Listener() {

        @Override
        public void onReload(AllocationConfiguration allocs) {
            allocConf.set(allocs);
        }
    });
    try {
        allocsLoader.reloadAllocations();
    } catch (Exception ex) {
        throw new IOException("Failed to load queue allocations", ex);
    }
    if (allocConf.get() == null) {
        allocConf.set(new AllocationConfiguration(conf));
    }
    QueuePlacementPolicy queuePolicy = allocConf.get().getPlacementPolicy();
    if (queuePolicy != null) {
        requestedQueue = queuePolicy.assignAppToQueue(requestedQueue, userName);
        if (StringUtils.isNotBlank(requestedQueue)) {
            LOG.debug("Setting queue name to " + requestedQueue + " for user " + userName);
            conf.set(MR2_JOB_QUEUE_PROPERTY, requestedQueue);
        }
    }
}
Also used : QueuePlacementPolicy(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.QueuePlacementPolicy) AllocationConfiguration(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfiguration) AtomicReference(java.util.concurrent.atomic.AtomicReference) IOException(java.io.IOException) AllocationFileLoaderService(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationFileLoaderService) IOException(java.io.IOException)

Aggregations

AllocationConfiguration (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfiguration)3 IOException (java.io.IOException)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 ReservationAgent (org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent)1 AllocationFileLoaderService (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationFileLoaderService)1 FSQueue (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue)1 FairScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler)1 FairSchedulerConfiguration (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration)1 QueueManager (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.QueueManager)1 QueuePlacementPolicy (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.QueuePlacementPolicy)1 Clock (org.apache.hadoop.yarn.util.Clock)1 SystemClock (org.apache.hadoop.yarn.util.SystemClock)1 Test (org.junit.Test)1