private void setupPlanFollower() throws Exception { ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); mClock = mock(Clock.class); mAgent = mock(ReservationAgent.class); String reservationQ = testUtil.getFullReservationQueueName(); AllocationConfiguration allocConf = fs.getAllocationConfiguration(); allocConf.setReservationWindow(20L); allocConf.setAverageCapacity(20); policy.init(reservationQ, allocConf); }
@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 void setupPlanFollower() throws Exception { ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); mClock = mock(Clock.class); mAgent = mock(ReservationAgent.class); String reservationQ = testUtil.getFullReservationQueueName(); CapacitySchedulerConfiguration csConf = cs.getConfiguration(); csConf.setReservationWindow(reservationQ, 20L); csConf.setMaximumCapacity(reservationQ, 40); csConf.setAverageCapacity(reservationQ, 20); policy.init(reservationQ, csConf); }
@Before public void setup() throws Exception { // 1 sec step step = 1000L; initTime = System.currentTimeMillis(); minAlloc = Resource.newInstance(1024, 1); res = new DefaultResourceCalculator(); maxAlloc = Resource.newInstance(1024 * 8, 8); mAgent = mock(ReservationAgent.class); ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); String reservationQ = testUtil.getFullReservationQueueName(); QueueMetrics rootQueueMetrics = mock(QueueMetrics.class); Resource clusterResource = testUtil.calculateClusterResource(totCont); ReservationSchedulerConfiguration conf = mock (ReservationSchedulerConfiguration.class); NoOverCommitPolicy policy = new NoOverCommitPolicy(); policy.init(reservationQ, conf); plan = new InMemoryPlan(rootQueueMetrics, policy, mAgent, clusterResource, step, res, minAlloc, maxAlloc, "dedicated", null, true); }
@Before public void setup() throws Exception { long seed = rand.nextLong(); rand.setSeed(seed); Log.info("Running with seed: " + seed); // setting completely loose quotas long timeWindow = 1000000L; Resource clusterCapacity = Resource.newInstance(100 * 1024, 100); step = 1000L; ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); String reservationQ = testUtil.getFullReservationQueueName(); float instConstraint = 100; float avgConstraint = 100; ReservationSchedulerConfiguration conf = ReservationSystemTestUtil.createConf(reservationQ, timeWindow, instConstraint, avgConstraint); CapacityOverTimePolicy policy = new CapacityOverTimePolicy(); policy.init(reservationQ, conf); agent = new GreedyReservationAgent(); QueueMetrics queueMetrics = mock(QueueMetrics.class); plan = new InMemoryPlan(queueMetrics, policy, agent, clusterCapacity, step, res, minAlloc, maxAlloc, "dedicated", null, true); }
Resource clusterCapacity = Resource.newInstance(500 * 100 * 1024, 500 * 32); step = 1000L; ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); CapacityScheduler scheduler = testUtil.mockCapacityScheduler(500 * 100); String reservationQ = testUtil.getFullReservationQueueName();
Resource clusterCapacity = Resource.newInstance(500 * 100 * 1024, 500 * 32); step = 1000L; ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); CapacityScheduler scheduler = testUtil.mockCapacityScheduler(500 * 100); String reservationQ =
@Before public void setup() throws Exception { // 24h window timeWindow = 86400000L; // 1 sec step step = 1000L; // 25% avg cap on capacity avgConstraint = 25; // 70% instantaneous cap on capacity instConstraint = 70; initTime = System.currentTimeMillis(); minAlloc = Resource.newInstance(1024, 1); res = new DefaultResourceCalculator(); maxAlloc = Resource.newInstance(1024 * 8, 8); mAgent = mock(ReservationAgent.class); ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); QueueMetrics rootQueueMetrics = mock(QueueMetrics.class); String reservationQ = testUtil.getFullReservationQueueName(); Resource clusterResource = testUtil.calculateClusterResource(totCont); ReservationSchedulerConfiguration conf = ReservationSystemTestUtil.createConf(reservationQ, timeWindow, instConstraint, avgConstraint); CapacityOverTimePolicy policy = new CapacityOverTimePolicy(); policy.init(reservationQ, conf); plan = new InMemoryPlan(rootQueueMetrics, policy, mAgent, clusterResource, step, res, minAlloc, maxAlloc, "dedicated", null, true); }
@Test public void testInitialize() { ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); CapacityScheduler capScheduler = null; try { capScheduler = testUtil.mockCapacityScheduler(10); } catch (IOException e) { Assert.fail(e.getMessage()); } CapacityReservationSystem reservationSystem = new CapacityReservationSystem(); reservationSystem.setRMContext(capScheduler.getRMContext()); try { reservationSystem.reinitialize(capScheduler.getConf(), capScheduler.getRMContext()); } catch (YarnException e) { Assert.fail(e.getMessage()); } String planQName = testUtil.getreservationQueueName(); ReservationSystemTestUtil.validateReservationQueue(reservationSystem, planQName); }
@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 testReinitialize() { ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); CapacityScheduler capScheduler = null; try {
ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil();