use of io.cdap.cdap.app.guice.DistributedProgramContainerModule in project cdap by caskdata.
the class SparkRuntimeContextProvider method createInjector.
@VisibleForTesting
public static Injector createInjector(CConfiguration cConf, Configuration hConf, ProgramId programId, ProgramOptions programOptions) {
String runId = programOptions.getArguments().getOption(ProgramOptionConstants.RUN_ID);
List<Module> modules = new ArrayList<>();
modules.add(new DistributedProgramContainerModule(cConf, hConf, programId.run(runId), programOptions));
ClusterMode clusterMode = ProgramRunners.getClusterMode(programOptions);
modules.add(clusterMode == ClusterMode.ON_PREMISE ? new DistributedArtifactManagerModule() : new AbstractModule() {
@Override
protected void configure() {
bind(PluginFinder.class).to(UnsupportedPluginFinder.class);
}
});
return Guice.createInjector(modules);
}
use of io.cdap.cdap.app.guice.DistributedProgramContainerModule in project cdap by caskdata.
the class DistributedMapReduceTaskContextProvider method createInjector.
private static Injector createInjector(CConfiguration cConf, Configuration hConf) {
MapReduceContextConfig mapReduceContextConfig = new MapReduceContextConfig(hConf);
// principal will be null if running on a kerberos distributed cluster
ProgramOptions programOptions = mapReduceContextConfig.getProgramOptions();
Arguments systemArgs = programOptions.getArguments();
String runId = systemArgs.getOption(ProgramOptionConstants.RUN_ID);
return Guice.createInjector(new DistributedProgramContainerModule(cConf, hConf, mapReduceContextConfig.getProgramId().run(runId), programOptions));
}
Aggregations