Search in sources :

Example 6 with ContainerPlan

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());
}
Also used : ContainerPlan(org.apache.heron.spi.packing.PackingPlan.ContainerPlan) AllocatedEvaluator(org.apache.reef.driver.evaluator.AllocatedEvaluator)

Example 7 with ContainerPlan

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);
}
Also used : ContainerPlan(org.apache.heron.spi.packing.PackingPlan.ContainerPlan) PackingPlan(org.apache.heron.spi.packing.PackingPlan) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 8 with ContainerPlan

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);
}
Also used : ContainerPlan(org.apache.heron.spi.packing.PackingPlan.ContainerPlan) PackingPlan(org.apache.heron.spi.packing.PackingPlan) HashSet(java.util.HashSet) Pair(org.apache.heron.common.basics.Pair) Before(org.junit.Before)

Aggregations

ContainerPlan (org.apache.heron.spi.packing.PackingPlan.ContainerPlan)8 HashSet (java.util.HashSet)5 PackingPlan (org.apache.heron.spi.packing.PackingPlan)5 Before (org.junit.Before)3 AllocatedEvaluator (org.apache.reef.driver.evaluator.AllocatedEvaluator)2 ArrayList (java.util.ArrayList)1 TopologyAPI (org.apache.heron.api.generated.TopologyAPI)1 Pair (org.apache.heron.common.basics.Pair)1 LauncherUtils (org.apache.heron.scheduler.utils.LauncherUtils)1 Config (org.apache.heron.spi.common.Config)1 IPacking (org.apache.heron.spi.packing.IPacking)1 InstancePlan (org.apache.heron.spi.packing.PackingPlan.InstancePlan)1 Resource (org.apache.heron.spi.packing.Resource)1 ILauncher (org.apache.heron.spi.scheduler.ILauncher)1 SchedulerStateManagerAdaptor (org.apache.heron.spi.statemgr.SchedulerStateManagerAdaptor)1