use of org.apache.heron.spi.packing.PackingPlan.ContainerPlan in project heron by twitter.
the class HeronMasterDriver method restartWorker.
public void restartWorker(int id) throws ContainerAllocationException {
LOG.log(Level.INFO, "Find & restart container for id={0}", id);
Optional<HeronWorker> worker = multiKeyWorkerMap.lookupByWorkerId(id);
if (!worker.isPresent()) {
LOG.log(Level.WARNING, "Requesting a new container for: {0}", id);
ContainerPlan containerPlan = containerPlans.get(id);
if (containerPlan == null) {
throw new IllegalArgumentException(String.format("There is no container for %s in packing plan.", id));
}
worker = Optional.of(new HeronWorker(id, containerPlan.getRequiredResource()));
} else {
AllocatedEvaluator evaluator = multiKeyWorkerMap.detachEvaluatorAndRemove(worker.get());
LOG.log(Level.INFO, "Shutting down container {0}", evaluator.getId());
evaluator.close();
}
requestContainerForWorker(worker.get().workerId, worker.get());
}
use of org.apache.heron.spi.packing.PackingPlan.ContainerPlan in project heron by twitter.
the class SubmitDryRunRenderTest method setUp.
@Before
public void setUp() throws Exception {
final String COMPONENT_A = "exclaim1";
final String COMPONENT_B = "word";
ContainerPlan containerPlanA = PackingTestUtils.testContainerPlan(1, new Pair<>(COMPONENT_A, 1), new Pair<>(COMPONENT_A, 3), new Pair<>(COMPONENT_B, 5));
ContainerPlan containerPlanB = PackingTestUtils.testContainerPlan(2, new Pair<>(COMPONENT_A, 2), new Pair<>(COMPONENT_A, 4), new Pair<>(COMPONENT_B, 6));
Set<ContainerPlan> containerPlans = new HashSet<>();
containerPlans.add(containerPlanA);
containerPlans.add(containerPlanB);
plan = new PackingPlan("A", containerPlans);
}
use of org.apache.heron.spi.packing.PackingPlan.ContainerPlan in project heron by twitter.
the class UpdateDryRunRenderTest method setUp.
@Before
public void setUp() throws Exception {
// set up original packing plan
final String COMPONENT_A = "exclaim1";
final String COMPONENT_B = "word";
ContainerPlan containerPlanA = PackingTestUtils.testContainerPlan(1, new Pair<>(COMPONENT_A, 1), new Pair<>(COMPONENT_A, 3), new Pair<>(COMPONENT_B, 5));
ContainerPlan containerPlanB = PackingTestUtils.testContainerPlan(2, new Pair<>(COMPONENT_A, 2), new Pair<>(COMPONENT_A, 4), new Pair<>(COMPONENT_B, 6));
Set<ContainerPlan> containerPlans = new HashSet<>();
containerPlans.add(containerPlanA);
containerPlans.add(containerPlanB);
originalPlan = new PackingPlan("ORIG", containerPlans);
// setup new packing plan A: word:1, exclaim1:9
Set<ContainerPlan> containerPlansA = new HashSet<>();
containerPlansA.add(containerPlanA);
containerPlansA.add(PackingTestUtils.testContainerPlan(2, new Pair<>(COMPONENT_A, 4), new Pair<>(COMPONENT_A, 2), new Pair<>(COMPONENT_A, 6)));
containerPlansA.add(PackingTestUtils.testContainerPlan(3, new Pair<>(COMPONENT_A, 7), new Pair<>(COMPONENT_A, 8), new Pair<>(COMPONENT_A, 9)));
containerPlansA.add(PackingTestUtils.testContainerPlan(4, new Pair<>(COMPONENT_A, 10)));
newPlanA = new PackingPlan("A", containerPlansA);
// setup new packing plan B: word:1, exclaim1:1
Set<ContainerPlan> containerPlansB = new HashSet<>();
containerPlansB.add(PackingTestUtils.testContainerPlan(1, new Pair<>(COMPONENT_A, 3), new Pair<>(COMPONENT_B, 5)));
newPlanB = new PackingPlan("B", containerPlansB);
}
Aggregations