@Before public void setUp() throws Exception { conf = createConfiguration(); ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); // Setup rmContext = TestUtils.getMockRMContext(); spyRMContext = spy(rmContext); fs = ReservationSystemTestUtil.setupFairScheduler(spyRMContext, conf, 125); scheduler = fs; ConcurrentMap<ApplicationId, RMApp> spyApps = spy(new ConcurrentHashMap<ApplicationId, RMApp>()); RMApp rmApp = mock(RMApp.class); when(rmApp.getRMAppAttempt((ApplicationAttemptId) Matchers.any())) .thenReturn(null); Mockito.doReturn(rmApp).when(spyApps).get((ApplicationId) Matchers.any()); when(spyRMContext.getRMApps()).thenReturn(spyApps); ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); setupPlanFollower(); }
@Before public void setUp() throws Exception { conf = createConfiguration(); ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); // Setup rmContext = TestUtils.getMockRMContext(); spyRMContext = spy(rmContext); fs = ReservationSystemTestUtil.setupFairScheduler(testUtil, spyRMContext, conf, 125); scheduler = fs; ConcurrentMap<ApplicationId, RMApp> spyApps = spy(new ConcurrentHashMap<ApplicationId, RMApp>()); RMApp rmApp = mock(RMApp.class); when(rmApp.getRMAppAttempt((ApplicationAttemptId) Matchers.any())) .thenReturn(null); Mockito.doReturn(rmApp).when(spyApps).get((ApplicationId) Matchers.any()); when(spyRMContext.getRMApps()).thenReturn(spyApps); ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); setupPlanFollower(); }
private FairScheduler initializeFairScheduler() throws IOException { Configuration conf = createFSConfiguration(); ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); // Setup mockRMContext = ReservationSystemTestUtil.createRMContext(conf); return ReservationSystemTestUtil .setupFairScheduler(mockRMContext, conf, 10); } }
private Configuration getSchedulerDynamicConfiguration() throws IOException { conf.setBoolean(YarnConfiguration.RM_RESERVATION_SYSTEM_ENABLE, true); conf.setTimeDuration( YarnConfiguration.RM_RESERVATION_SYSTEM_PLAN_FOLLOWER_TIME_STEP, 1L, TimeUnit.SECONDS); if (getSchedulerType() == SchedulerType.CAPACITY) { CapacitySchedulerConfiguration schedulerConf = new CapacitySchedulerConfiguration(conf); ReservationSystemTestUtil.setupDynamicQueueConfiguration(schedulerConf); return schedulerConf; } else { String allocFile = new File(FairSchedulerTestBase.TEST_DIR, TestWorkPreservingRMRestart.class.getSimpleName() + ".xml") .getAbsolutePath(); ReservationSystemTestUtil.setupFSAllocationFile(allocFile); conf.setClass(YarnConfiguration.RM_SCHEDULER, FairScheduler.class, ResourceScheduler.class); conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, allocFile); return conf; } }
@Test public void testFairReservationSystemInitialize() throws IOException { ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); // Setup RMContext mockRMContext = testUtil.createRMContext(conf); scheduler = ReservationSystemTestUtil.setupFairScheduler(testUtil, mockRMContext, conf, 10); FairReservationSystem reservationSystem = new FairReservationSystem(); reservationSystem.setRMContext(mockRMContext); try { reservationSystem.reinitialize(scheduler.getConf(), mockRMContext); } catch (YarnException e) { Assert.fail(e.getMessage()); } ReservationSystemTestUtil.validateReservationQueue(reservationSystem, testUtil.getFullReservationQueueName()); }
@Test public void testFairReservationSystemReinitialize() throws IOException { ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE);