use of com.datatorrent.stram.client.StramAppLauncher in project apex-core by apache.
the class ApexCli method getStramAppLauncher.
@SuppressWarnings("unused")
private StramAppLauncher getStramAppLauncher(String jarfileUri, Configuration config, boolean ignorePom) throws Exception {
URI uri = new URI(jarfileUri);
String scheme = uri.getScheme();
StramAppLauncher appLauncher = null;
if (scheme == null || scheme.equals("file")) {
File jf = new File(uri.getPath());
appLauncher = new StramAppLauncher(jf, config);
} else {
try (FileSystem tmpFs = FileSystem.newInstance(uri, conf)) {
Path path = new Path(uri.getPath());
appLauncher = new StramAppLauncher(tmpFs, path, config);
}
}
if (appLauncher != null) {
if (verboseLevel > 0) {
System.err.print(appLauncher.getMvnBuildClasspathOutput());
}
return appLauncher;
} else {
throw new CliException("Scheme " + scheme + " not supported.");
}
}
use of com.datatorrent.stram.client.StramAppLauncher in project apex-core by apache.
the class YarnAppLauncherImpl method launchApp.
@Override
public YarnAppHandleImpl launchApp(final StreamingApplication app, Configuration conf, Attribute.AttributeMap launchParameters) throws LauncherException {
if (launchParameters != null) {
for (Map.Entry<Attribute<?>, Object> entry : launchParameters.entrySet()) {
String property = propMapping.get(entry.getKey());
if (property != null) {
setConfiguration(conf, property, entry.getValue());
}
}
}
try {
String name = app.getClass().getName();
StramAppLauncher appLauncher = new StramAppLauncher(name, conf);
appLauncher.loadDependencies();
StreamingAppFactory appFactory = new StreamingAppFactory(name, app.getClass()) {
@Override
public LogicalPlan createApp(LogicalPlanConfiguration planConfig) {
return super.createApp(app, planConfig);
}
};
ApplicationId appId = appLauncher.launchApp(appFactory);
appLauncher.resetContextClassLoader();
return new YarnAppHandleImpl(appId, conf);
} catch (Exception ex) {
throw new LauncherException(ex);
}
}
Aggregations