@SuppressWarnings("rawtypes") public static void initializeRMContext(int numContainers, AbstractYarnScheduler scheduler, RMContext mockRMContext) { when(mockRMContext.getScheduler()).thenReturn(scheduler); Resource r = calculateClusterResource(numContainers); doReturn(r).when(scheduler).getClusterResource(); }
public static void initializeRMContext(int numContainers, AbstractYarnScheduler scheduler, RMContext mockRMContext) { when(mockRMContext.getScheduler()).thenReturn(scheduler); Resource r = calculateClusterResource(numContainers); doReturn(r).when(scheduler).getClusterResource(); }
@Before public void setup() { // 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); QueueMetrics rootQueueMetrics = mock(QueueMetrics.class); Resource clusterResource = ReservationSystemTestUtil.calculateClusterResource(totCont); // invoke implementors initialization of policy SharingPolicy policy = getInitializedPolicy(); RMContext context = ReservationSystemTestUtil.createMockRMContext(); plan = new InMemoryPlan(rootQueueMetrics, policy, mAgent, clusterResource, step, res, minAlloc, maxAlloc, "dedicated", null, true, context); }
@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); }
public static FairScheduler setupFairScheduler(RMContext rmContext, Configuration conf, int numContainers) throws IOException { FairScheduler scheduler = new FairScheduler(); scheduler.setRMContext(rmContext); when(rmContext.getScheduler()).thenReturn(scheduler); scheduler.init(conf); scheduler.start(); scheduler.reinitialize(conf, rmContext); Resource resource = ReservationSystemTestUtil.calculateClusterResource(numContainers); RMNode node1 = MockNodes.newNodeInfo(1, resource, 1, "127.0.0.1"); NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1); scheduler.handle(nodeEvent1); return scheduler; }
public static FairScheduler setupFairScheduler( ReservationSystemTestUtil testUtil, RMContext rmContext, Configuration conf, int numContainers) throws IOException { FairScheduler scheduler = new FairScheduler(); scheduler.setRMContext(rmContext); when(rmContext.getScheduler()).thenReturn(scheduler); scheduler.init(conf); scheduler.start(); scheduler.reinitialize(conf, rmContext); Resource resource = testUtil.calculateClusterResource(numContainers); RMNode node1 = MockNodes.newNodeInfo(1, resource, 1, "127.0.0.1"); NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1); scheduler.handle(nodeEvent1); return scheduler; }
@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); }