Search in sources :

Example 6 with PackingException

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

the class LauncherUtils method createPackingPlan.

/**
 * Returns a packing plan generated by configured packing class
 */
public PackingPlan createPackingPlan(final Config config, final Config runtime) throws PackingException {
    // Create an instance of the packing class
    String packingClass = Context.packingClass(config);
    IPacking packing;
    try {
        // create an instance of the packing class
        packing = ReflectionUtils.newInstance(packingClass);
    } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
        throw new PackingException(String.format("Failed to instantiate packing instance using packing class %s", packingClass), e);
    }
    try {
        TopologyAPI.Topology topology = Runtime.topology(runtime);
        packing.initialize(config, topology);
        return packing.pack();
    } finally {
        SysUtils.closeIgnoringExceptions(packing);
    }
}
Also used : IPacking(org.apache.heron.spi.packing.IPacking) PackingException(org.apache.heron.spi.packing.PackingException) TopologyAPI(org.apache.heron.api.generated.TopologyAPI)

Aggregations

PackingException (org.apache.heron.spi.packing.PackingException)6 SchedulerStateManagerAdaptor (org.apache.heron.spi.statemgr.SchedulerStateManagerAdaptor)3 URI (java.net.URI)2 TopologyAPI (org.apache.heron.api.generated.TopologyAPI)2 Config (org.apache.heron.spi.common.Config)2 PackingPlan (org.apache.heron.spi.packing.PackingPlan)2 LauncherException (org.apache.heron.spi.scheduler.LauncherException)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 MinRamConstraint (org.apache.heron.packing.constraints.MinRamConstraint)1 ResourceConstraint (org.apache.heron.packing.constraints.ResourceConstraint)1 ExecutionEnvironment (org.apache.heron.proto.system.ExecutionEnvironment)1 ISchedulerClient (org.apache.heron.scheduler.client.ISchedulerClient)1 SchedulerClientFactory (org.apache.heron.scheduler.client.SchedulerClientFactory)1 SubmitDryRunResponse (org.apache.heron.scheduler.dryrun.SubmitDryRunResponse)1 IPacking (org.apache.heron.spi.packing.IPacking)1 InstanceId (org.apache.heron.spi.packing.InstanceId)1 ILauncher (org.apache.heron.spi.scheduler.ILauncher)1 IStateManager (org.apache.heron.spi.statemgr.IStateManager)1