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