use of com.twitter.heron.spi.packing.PackingPlan.ContainerPlan in project incubator-heron by apache.
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 com.twitter.heron.spi.packing.PackingPlan.ContainerPlan in project incubator-heron by apache.
the class HeronMasterDriver method killWorkers.
/**
* Terminates any yarn containers associated with the given containers.
*/
public void killWorkers(Set<ContainerPlan> containers) {
for (ContainerPlan container : containers) {
LOG.log(Level.INFO, "Find and kill container for worker {0}", container.getId());
Optional<HeronWorker> worker = multiKeyWorkerMap.lookupByWorkerId(container.getId());
if (worker.isPresent()) {
LOG.log(Level.INFO, "Killing container {0} for worker {1}", new Object[] { worker.get().evaluator.getId(), worker.get().workerId });
AllocatedEvaluator evaluator = multiKeyWorkerMap.detachEvaluatorAndRemove(worker.get());
evaluator.close();
} else {
LOG.log(Level.WARNING, "Did not find worker for {0}", container.getId());
}
containerPlans.remove(container.getId());
}
}
use of com.twitter.heron.spi.packing.PackingPlan.ContainerPlan in project incubator-heron by apache.
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());
}
Aggregations