Search in sources :

Example 1 with RecoveryStorage

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");
    }
}
Also used : ClusterManagerServer(org.apache.zeppelin.cluster.ClusterManagerServer) NotebookServer(org.apache.zeppelin.socket.NotebookServer) AuthorizationService(org.apache.zeppelin.notebook.AuthorizationService) RecoveryStorage(org.apache.zeppelin.interpreter.recovery.RecoveryStorage) InterpreterSettingManager(org.apache.zeppelin.interpreter.InterpreterSettingManager) IOException(java.io.IOException)

Example 2 with RecoveryStorage

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;
}
Also used : ZeppelinConfiguration(org.apache.zeppelin.conf.ZeppelinConfiguration) URLClassLoader(java.net.URLClassLoader) RecoveryStorage(org.apache.zeppelin.interpreter.recovery.RecoveryStorage) IOException(java.io.IOException) SparkInterpreterLauncher(org.apache.zeppelin.interpreter.launcher.SparkInterpreterLauncher) InterpreterLauncher(org.apache.zeppelin.interpreter.launcher.InterpreterLauncher) StandardInterpreterLauncher(org.apache.zeppelin.interpreter.launcher.StandardInterpreterLauncher) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

IOException (java.io.IOException)2 RecoveryStorage (org.apache.zeppelin.interpreter.recovery.RecoveryStorage)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URLClassLoader (java.net.URLClassLoader)1 ClusterManagerServer (org.apache.zeppelin.cluster.ClusterManagerServer)1 ZeppelinConfiguration (org.apache.zeppelin.conf.ZeppelinConfiguration)1 InterpreterSettingManager (org.apache.zeppelin.interpreter.InterpreterSettingManager)1 InterpreterLauncher (org.apache.zeppelin.interpreter.launcher.InterpreterLauncher)1 SparkInterpreterLauncher (org.apache.zeppelin.interpreter.launcher.SparkInterpreterLauncher)1 StandardInterpreterLauncher (org.apache.zeppelin.interpreter.launcher.StandardInterpreterLauncher)1 AuthorizationService (org.apache.zeppelin.notebook.AuthorizationService)1 NotebookServer (org.apache.zeppelin.socket.NotebookServer)1