@Before public void setUp() throws IOException { scheduler = initializeScheduler(); rmContext = getRMContext(); reservationSystem = configureReservationSystem(); reservationSystem.setRMContext(rmContext); DefaultMetricsSystem.setMiniClusterMode(true); }
@SuppressWarnings("rawtypes") public AbstractYarnScheduler initializeScheduler() throws IOException { switch (getSchedulerType()) { case CAPACITY: return initializeCapacityScheduler(); case FAIR: return initializeFairScheduler(); } return null; }
Assert.fail(e.getMessage()); if (getSchedulerType().equals(SchedulerType.CAPACITY)) { ReservationSystemTestUtil.validateReservationQueue(reservationSystem, ReservationSystemTestUtil.getReservationQueueName()); updateSchedulerConf(conf, newQ); try { scheduler.reinitialize(conf, rmContext); Assert.fail(e.getMessage()); if (getSchedulerType().equals(SchedulerType.CAPACITY)) { ReservationSystemTestUtil.validateReservationQueue(reservationSystem, newQ);
public AbstractReservationSystem configureReservationSystem() { switch (getSchedulerType()) { case CAPACITY: return new CapacityReservationSystem(); case FAIR: return new FairReservationSystem(); } return null; }
@After public void tearDown() { conf = null; reservationSystem = null; rmContext = null; scheduler = null; clearRMContext(); QueueMetrics.clearQueueMetrics(); }
private FairScheduler initializeFairScheduler() throws IOException { Configuration conf = createFSConfiguration(); ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); // Setup mockRMContext = ReservationSystemTestUtil.createRMContext(conf); return ReservationSystemTestUtil .setupFairScheduler(mockRMContext, conf, 10); } }
public void updateSchedulerConf(Configuration conf, String newQ) throws IOException { switch (getSchedulerType()) { case CAPACITY: ReservationSystemTestUtil.updateQueueConfiguration( (CapacitySchedulerConfiguration) conf, newQ); case FAIR: ReservationSystemTestUtil.updateFSAllocationFile(ALLOC_FILE); } }
@Test public void testInitialize() throws IOException { try { reservationSystem.reinitialize(scheduler.getConfig(), rmContext); } catch (YarnException e) { Assert.fail(e.getMessage()); } if (getSchedulerType().equals(SchedulerType.CAPACITY)) { ReservationSystemTestUtil.validateReservationQueue(reservationSystem, ReservationSystemTestUtil.getReservationQueueName()); } else { ReservationSystemTestUtil.validateReservationQueue(reservationSystem, ReservationSystemTestUtil.getFullReservationQueueName()); } }