use of org.apache.zeppelin.interpreter.recovery.RecoveryStorage in project zeppelin by apache.
the class ZeppelinServer method setupClusterManagerServer.
private static void setupClusterManagerServer(ServiceLocator serviceLocator) {
if (conf.isClusterMode()) {
LOG.info("Cluster mode is enabled, starting ClusterManagerServer");
ClusterManagerServer clusterManagerServer = ClusterManagerServer.getInstance(conf);
NotebookServer notebookServer = serviceLocator.getService(NotebookServer.class);
clusterManagerServer.addClusterEventListeners(ClusterManagerServer.CLUSTER_NOTE_EVENT_TOPIC, notebookServer);
AuthorizationService authorizationService = serviceLocator.getService(AuthorizationService.class);
clusterManagerServer.addClusterEventListeners(ClusterManagerServer.CLUSTER_AUTH_EVENT_TOPIC, authorizationService);
InterpreterSettingManager interpreterSettingManager = serviceLocator.getService(InterpreterSettingManager.class);
clusterManagerServer.addClusterEventListeners(ClusterManagerServer.CLUSTER_INTP_SETTING_EVENT_TOPIC, interpreterSettingManager);
// This allows the ClusterInterpreterLauncher to listen for cluster events.
try {
InterpreterSettingManager intpSettingManager = sharedServiceLocator.getService(InterpreterSettingManager.class);
RecoveryStorage recoveryStorage = ReflectionUtils.createClazzInstance(conf.getRecoveryStorageClass(), new Class[] { ZeppelinConfiguration.class, InterpreterSettingManager.class }, new Object[] { conf, intpSettingManager });
recoveryStorage.init();
PluginManager.get().loadInterpreterLauncher(InterpreterSetting.CLUSTER_INTERPRETER_LAUNCHER_NAME, recoveryStorage);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
}
clusterManagerServer.start();
} else {
LOG.info("Cluster mode is disabled");
}
}
use of org.apache.zeppelin.interpreter.recovery.RecoveryStorage in project zeppelin by apache.
the class PluginManager method loadInterpreterLauncher.
public synchronized InterpreterLauncher loadInterpreterLauncher(String launcherPlugin, RecoveryStorage recoveryStorage) throws IOException {
if (cachedLaunchers.containsKey(launcherPlugin)) {
return cachedLaunchers.get(launcherPlugin);
}
String launcherClassName = "org.apache.zeppelin.interpreter.launcher." + launcherPlugin;
LOGGER.info("Loading Interpreter Launcher Plugin: {}", launcherClassName);
if (builtinLauncherClassNames.contains(launcherClassName) || Boolean.parseBoolean(System.getProperty("zeppelin.isTest", "false"))) {
try {
return (InterpreterLauncher) (Class.forName(launcherClassName)).getConstructor(ZeppelinConfiguration.class, RecoveryStorage.class).newInstance(zConf, recoveryStorage);
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) {
throw new IOException("Fail to instantiate InterpreterLauncher from classpath directly:" + launcherClassName, e);
}
}
URLClassLoader pluginClassLoader = getPluginClassLoader(pluginsDir, "Launcher", launcherPlugin);
InterpreterLauncher launcher = null;
try {
launcher = (InterpreterLauncher) (Class.forName(launcherClassName, true, pluginClassLoader)).getConstructor(ZeppelinConfiguration.class, RecoveryStorage.class).newInstance(zConf, recoveryStorage);
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) {
throw new IOException("Fail to instantiate Launcher " + launcherPlugin + " from plugin pluginDir: " + pluginsDir, e);
}
cachedLaunchers.put(launcherPlugin, launcher);
return launcher;
}
Aggregations