Search in sources :

Example 1 with InstancePlan

use of org.apache.heron.spi.packing.PackingPlan.InstancePlan in project heron by twitter.

the class PackingPlanProvider method getBoltInstanceNames.

public String[] getBoltInstanceNames(String... boltComponents) {
    HashSet<String> boltComponentNames = new HashSet<>();
    Collections.addAll(boltComponentNames, boltComponents);
    PackingPlan packing = get();
    ArrayList<String> boltInstanceNames = new ArrayList<>();
    for (ContainerPlan containerPlan : packing.getContainers()) {
        for (InstancePlan instancePlan : containerPlan.getInstances()) {
            if (!boltComponentNames.contains(instancePlan.getComponentName())) {
                continue;
            }
            String name = "container_" + containerPlan.getId() + "_" + instancePlan.getComponentName() + "_" + instancePlan.getTaskId();
            boltInstanceNames.add(name);
        }
    }
    return boltInstanceNames.toArray(new String[boltInstanceNames.size()]);
}
Also used : ContainerPlan(org.apache.heron.spi.packing.PackingPlan.ContainerPlan) PackingPlan(org.apache.heron.spi.packing.PackingPlan) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) InstancePlan(org.apache.heron.spi.packing.PackingPlan.InstancePlan)

Aggregations

ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 PackingPlan (org.apache.heron.spi.packing.PackingPlan)1 ContainerPlan (org.apache.heron.spi.packing.PackingPlan.ContainerPlan)1 InstancePlan (org.apache.heron.spi.packing.PackingPlan.InstancePlan)1