Search in sources :

Example 1 with InstancePlan

use of com.twitter.heron.spi.packing.PackingPlan.InstancePlan in project incubator-heron by apache.

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(com.twitter.heron.spi.packing.PackingPlan.ContainerPlan) PackingPlan(com.twitter.heron.spi.packing.PackingPlan) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) InstancePlan(com.twitter.heron.spi.packing.PackingPlan.InstancePlan)

Aggregations

PackingPlan (com.twitter.heron.spi.packing.PackingPlan)1 ContainerPlan (com.twitter.heron.spi.packing.PackingPlan.ContainerPlan)1 InstancePlan (com.twitter.heron.spi.packing.PackingPlan.InstancePlan)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1