use of org.apache.heron.spi.packing.PackingPlan in project heron by twitter.
the class HeronMasterDriverTest method scheduleHeronWorkersRequestsContainersForPacking.
@Test
public void scheduleHeronWorkersRequestsContainersForPacking() throws Exception {
Set<PackingPlan.ContainerPlan> containers = new HashSet<>();
PackingPlan.ContainerPlan container1 = PackingTestUtils.testContainerPlan(1, 1, 2);
containers.add(container1);
PackingPlan.ContainerPlan container2 = PackingTestUtils.testContainerPlan(2, 1, 2, 3);
containers.add(container2);
PackingPlan packing = new PackingPlan("packingId", containers);
spyDriver.scheduleHeronWorkers(packing);
verify(mockRequestor, times(2)).submit(any(EvaluatorRequest.class));
verify(spyDriver, times(1)).requestContainerForWorker(eq(1), anyHeronWorker());
verify(spyDriver, times(1)).requestContainerForWorker(eq(2), anyHeronWorker());
verify(spyDriver, times(1)).createEvaluatorRequest(getCpu(container1), getRam(container1));
verify(spyDriver, times(1)).createEvaluatorRequest(getCpu(container2), getRam(container2));
}
use of org.apache.heron.spi.packing.PackingPlan in project heron by twitter.
the class HeronMasterDriverTest method onNextAllocatedEvaluatorStartsWorker.
@Test
public void onNextAllocatedEvaluatorStartsWorker() throws Exception {
PackingPlan packingPlan = PackingTestUtils.testPackingPlan("test", new RoundRobinPacking());
spyDriver.scheduleHeronWorkers(packingPlan);
assertTrue(spyDriver.lookupByContainerPlan(1).isPresent());
PackingPlan.ContainerPlan containerPlan = spyDriver.lookupByContainerPlan(1).get();
AllocatedEvaluator mockEvaluator = createMockEvaluator("test", getCpu(containerPlan), getRam(containerPlan));
assertFalse(spyDriver.lookupByEvaluatorId("test").isPresent());
spyDriver.new ContainerAllocationHandler().onNext(mockEvaluator);
assertTrue(spyDriver.lookupByEvaluatorId("test").isPresent());
assertEquals(Integer.valueOf(1), spyDriver.lookupByEvaluatorId("test").get());
verify(mockEvaluator, times(1)).submitContext(any(Configuration.class));
}
use of org.apache.heron.spi.packing.PackingPlan in project heron by twitter.
the class YarnSchedulerTest method delegatesToDriverOnSchedule.
@Test
public void delegatesToDriverOnSchedule() throws Exception {
HeronMasterDriver mockHeronDriver = Mockito.mock(HeronMasterDriver.class);
HeronMasterDriverProvider.setInstance(mockHeronDriver);
Mockito.doNothing().when(mockHeronDriver).launchTManager();
IScheduler scheduler = new YarnScheduler();
PackingPlan mockPacking = Mockito.mock(PackingPlan.class);
scheduler.onSchedule(mockPacking);
InOrder invocationOrder = Mockito.inOrder(mockHeronDriver);
invocationOrder.verify(mockHeronDriver).scheduleHeronWorkers(mockPacking);
invocationOrder.verify(mockHeronDriver).launchTManager();
}
Aggregations