YarnCLI extends Configured implements Tool { protected YarnClient createYarnClient() { return YarnClient.createYarnClient(); } YarnCLI(); void setSysOutPrintStream(PrintStream sysout); void setSysErrPrintStream(PrintStream syserr); YarnClient getClient(); void setClient(YarnClient client); void stop(); static final String STATUS_CMD; static final String LIST_CMD; static final String KILL_CMD; static final String FAIL_CMD; static final String MOVE_TO_QUEUE_CMD; static final String HELP_CMD; static final String SIGNAL_CMD; }
@Test public void testGetQueueInfoPreemptionDisabled() throws Exception { CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration(); ReservationSystemTestUtil.setupQueueConfiguration(conf); conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class, ResourceScheduler.class); conf.setBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS, true); conf.set(YarnConfiguration.RM_SCHEDULER_MONITOR_POLICIES, "org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity." + "ProportionalCapacityPreemptionPolicy"); conf.setBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS, true); conf.setBoolean(PREFIX + "root.a.a1.disable_preemption", true); try (MiniYARNCluster cluster = new MiniYARNCluster("testReservationAPIs", 2, 1, 1); YarnClient yarnClient = YarnClient.createYarnClient()) { cluster.init(conf); cluster.start(); final Configuration yarnConf = cluster.getConfig(); yarnClient.init(yarnConf); yarnClient.start(); QueueCLI cli = createAndGetQueueCLI(yarnClient); sysOutStream.reset(); int result = cli.run(new String[] { "-status", "a1" }); assertEquals(0, result); String queueStatusOut = sysOutStream.toString(); Assert.assertTrue(queueStatusOut .contains("\tPreemption : disabled")); Assert.assertTrue(queueStatusOut .contains("Intra-queue Preemption : disabled")); } }