use of co.cask.cdap.api.flow.flowlet.FlowletSpecification in project cdap by caskdata.
the class DistributedFlowProgramRunner method setupLaunchConfig.
@Override
protected void setupLaunchConfig(LaunchConfig launchConfig, Program program, ProgramOptions options, CConfiguration cConf, Configuration hConf, File tempDir) {
// Add runnables
Map<String, String> args = options.getUserArguments().asMap();
FlowSpecification flowSpec = getFlowSpecification(program);
for (Map.Entry<String, FlowletDefinition> entry : flowSpec.getFlowlets().entrySet()) {
FlowletDefinition flowletDefinition = entry.getValue();
FlowletSpecification flowletSpec = flowletDefinition.getFlowletSpec();
String flowletName = entry.getKey();
Map<String, String> flowletArgs = RuntimeArguments.extractScope(FlowUtils.FLOWLET_SCOPE, flowletName, args);
Resources resources = SystemArguments.getResources(flowletArgs, flowletSpec.getResources());
launchConfig.addRunnable(entry.getKey(), new FlowletTwillRunnable(flowletName), resources, flowletDefinition.getInstances());
}
}
Aggregations