use of com.twitter.heron.spi.packing.PackingPlan in project heron by twitter.
the class FirstFitDecreasingPackingTest method testCompleteRamMapRequested2.
/**
* Test the scenario ram map config is fully set
*/
@Test
public void testCompleteRamMapRequested2() throws Exception {
ByteAmount maxContainerRam = ByteAmount.fromGigabytes(10);
// Explicit set component ram map
ByteAmount boltRam = ByteAmount.fromGigabytes(1);
ByteAmount spoutRam = ByteAmount.fromGigabytes(2);
topologyConfig.setContainerMaxRamHint(maxContainerRam);
topologyConfig.setComponentRam(BOLT_NAME, boltRam);
topologyConfig.setComponentRam(SPOUT_NAME, spoutRam);
TopologyAPI.Topology topologyExplicitRamMap = getTopology(spoutParallelism, boltParallelism, topologyConfig);
PackingPlan packingPlanExplicitRamMap = pack(topologyExplicitRamMap);
Assert.assertEquals(2, packingPlanExplicitRamMap.getContainers().size());
Assert.assertEquals(totalInstances, packingPlanExplicitRamMap.getInstanceCount());
AssertPacking.assertNumInstances(packingPlanExplicitRamMap.getContainers(), BOLT_NAME, 3);
AssertPacking.assertNumInstances(packingPlanExplicitRamMap.getContainers(), SPOUT_NAME, 4);
AssertPacking.assertContainers(packingPlanExplicitRamMap.getContainers(), BOLT_NAME, SPOUT_NAME, boltRam, spoutRam, maxContainerRam);
AssertPacking.assertContainerRam(packingPlanExplicitRamMap.getContainers(), maxContainerRam);
}
use of com.twitter.heron.spi.packing.PackingPlan in project heron by twitter.
the class FirstFitDecreasingPackingTest method testScaleDown.
/**
* Test the scenario where the scaling down is requested
*/
@Test
public void testScaleDown() throws Exception {
int spoutScalingDown = -3;
int boltScalingDown = -2;
Map<String, Integer> componentChanges = new HashMap<>();
//leave 1 spout
componentChanges.put(SPOUT_NAME, spoutScalingDown);
//leave 1 bolt
componentChanges.put(BOLT_NAME, boltScalingDown);
int numContainersBeforeRepack = 2;
PackingPlan newPackingPlan = doDefaultScalingTest(componentChanges, numContainersBeforeRepack);
Assert.assertEquals(2, newPackingPlan.getContainers().size());
Assert.assertEquals((Integer) (totalInstances + spoutScalingDown + boltScalingDown), newPackingPlan.getInstanceCount());
AssertPacking.assertNumInstances(newPackingPlan.getContainers(), BOLT_NAME, 1);
AssertPacking.assertNumInstances(newPackingPlan.getContainers(), SPOUT_NAME, 1);
}
use of com.twitter.heron.spi.packing.PackingPlan in project heron by twitter.
the class PackingPlanBuilderTest method testInvalidContainerRemoveFromPackingPlan.
@Test(expected = PackingException.class)
public void testInvalidContainerRemoveFromPackingPlan() throws ResourceExceededException {
PackingPlan plan = doCreatePackingPlanTest(testContainerInstances);
@SuppressWarnings({ "unchecked", "rawtypes" }) Pair<Integer, String>[] removed = new Pair[] { new Pair<>(7, "componentA") };
PackingTestHelper.removeFromTestPackingPlan(TOPOLOGY_ID, plan, removed, 0);
}
use of com.twitter.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).launchTMaster();
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).launchTMaster();
}
use of com.twitter.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));
}
Aggregations