use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration 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.FairSchedulerConfiguration in project hadoop by apache.
the class TestRMWebAppFairScheduler method mockFairSchedulerWithoutApps.
private static FairScheduler mockFairSchedulerWithoutApps(RMContext rmContext) throws IOException {
FairScheduler fs = new FairScheduler() {
@Override
public FSAppAttempt getSchedulerApp(ApplicationAttemptId applicationAttemptId) {
return null;
}
@Override
public FSAppAttempt getApplicationAttempt(ApplicationAttemptId applicationAttemptId) {
return null;
}
};
FairSchedulerConfiguration conf = new FairSchedulerConfiguration();
fs.setRMContext(rmContext);
fs.init(conf);
return fs;
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration in project hadoop by apache.
the class TestRMWebAppFairScheduler method mockFairScheduler.
private static FairScheduler mockFairScheduler() throws IOException {
FairScheduler fs = new FairScheduler();
FairSchedulerConfiguration conf = new FairSchedulerConfiguration();
fs.setRMContext(new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(conf), new NMTokenSecretManagerInRM(conf), new ClientToAMTokenSecretManagerInRM(), null));
fs.init(conf);
return fs;
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration in project hadoop by apache.
the class ReservationACLsTestBase method createFairSchedulerConfiguration.
private static Configuration createFairSchedulerConfiguration() throws IOException {
FairSchedulerConfiguration fsConf = new FairSchedulerConfiguration();
final String TEST_DIR = new File(System.getProperty("test.build.data", "/tmp")).getAbsolutePath();
final String ALLOC_FILE = new File(TEST_DIR, "test-queues.xml").getAbsolutePath();
PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
out.println("<?xml version=\"1.0\"?>");
out.println("<allocations>");
out.println(" <defaultQueueSchedulingPolicy>drf" + "</defaultQueueSchedulingPolicy>");
out.println(" <queue name=\"queueA\">");
out.println(" <aclSubmitReservations>" + "queueA_user,common_user " + "</aclSubmitReservations>");
out.println(" <aclAdministerReservations>" + "queueA_admin " + "</aclAdministerReservations>");
out.println(" <aclListReservations>common_user </aclListReservations>");
out.println(" <aclSubmitApps>queueA_user,common_user </aclSubmitApps>");
out.println(" <aclAdministerApps>queueA_admin </aclAdministerApps>");
out.println(" <reservation> </reservation>");
out.println(" </queue>");
out.println(" <queue name=\"queueB\">");
out.println(" <aclSubmitApps>queueB_user,common_user </aclSubmitApps>");
out.println(" <aclAdministerApps>queueB_admin </aclAdministerApps>");
out.println(" <aclSubmitReservations>" + "queueB_user,common_user " + "</aclSubmitReservations>");
out.println(" <aclAdministerReservations>" + "queueB_admin " + "</aclAdministerReservations>");
out.println(" <aclListReservations>common_user </aclListReservations>");
out.println(" <reservation> </reservation>");
out.println(" </queue>");
out.println(" <queue name=\"queueC\">");
out.println(" <reservation> </reservation>");
out.println(" </queue>");
out.println("</allocations>");
out.close();
fsConf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
fsConf.setBoolean(YarnConfiguration.RM_RESERVATION_SYSTEM_ENABLE, true);
fsConf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
fsConf.setBoolean(YarnConfiguration.YARN_RESERVATION_ACL_ENABLE, true);
fsConf.set(YarnConfiguration.RM_SCHEDULER, FairScheduler.class.getName());
return fsConf;
}
Aggregations