Search in sources :

Example 1 with FairSchedulerConfiguration

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());
}
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 2 with FairSchedulerConfiguration

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;
}
Also used : FairSchedulerConfiguration(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration) FairScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId)

Example 3 with FairSchedulerConfiguration

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;
}
Also used : FairSchedulerConfiguration(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration) ClientToAMTokenSecretManagerInRM(org.apache.hadoop.yarn.server.resourcemanager.security.ClientToAMTokenSecretManagerInRM) FairScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler) RMContainerTokenSecretManager(org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager) NMTokenSecretManagerInRM(org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM) RMContextImpl(org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl)

Example 4 with FairSchedulerConfiguration

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;
}
Also used : FairSchedulerConfiguration(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration) FairScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler) FileWriter(java.io.FileWriter) File(java.io.File) PrintWriter(java.io.PrintWriter)

Aggregations

FairScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler)4 FairSchedulerConfiguration (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration)4 File (java.io.File)1 FileWriter (java.io.FileWriter)1 PrintWriter (java.io.PrintWriter)1 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)1 RMContextImpl (org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl)1 AllocationConfiguration (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfiguration)1 FSQueue (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue)1 QueueManager (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.QueueManager)1 ClientToAMTokenSecretManagerInRM (org.apache.hadoop.yarn.server.resourcemanager.security.ClientToAMTokenSecretManagerInRM)1 NMTokenSecretManagerInRM (org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM)1 RMContainerTokenSecretManager (org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager)1 SystemClock (org.apache.hadoop.yarn.util.SystemClock)1 Test (org.junit.Test)1