Search in sources :

Example 1 with InterpreterLauncher

use of org.apache.zeppelin.interpreter.launcher.InterpreterLauncher in project zeppelin by apache.

the class InterpreterSetting method createInterpreterProcess.

synchronized RemoteInterpreterProcess createInterpreterProcess(String interpreterGroupId, String userName, Properties properties) throws IOException {
    InterpreterLauncher launcher = createLauncher(properties);
    InterpreterLaunchContext launchContext = new InterpreterLaunchContext(properties, option, interpreterRunner, userName, interpreterGroupId, id, group, name, interpreterEventServer.getPort(), interpreterEventServer.getHost());
    RemoteInterpreterProcess process = (RemoteInterpreterProcess) launcher.launch(launchContext);
    recoveryStorage.onInterpreterClientStart(process);
    return process;
}
Also used : InterpreterLaunchContext(org.apache.zeppelin.interpreter.launcher.InterpreterLaunchContext) RemoteInterpreterProcess(org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcess) InterpreterLauncher(org.apache.zeppelin.interpreter.launcher.InterpreterLauncher)

Example 2 with InterpreterLauncher

use of org.apache.zeppelin.interpreter.launcher.InterpreterLauncher 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

InterpreterLauncher (org.apache.zeppelin.interpreter.launcher.InterpreterLauncher)2 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URLClassLoader (java.net.URLClassLoader)1 ZeppelinConfiguration (org.apache.zeppelin.conf.ZeppelinConfiguration)1 InterpreterLaunchContext (org.apache.zeppelin.interpreter.launcher.InterpreterLaunchContext)1 SparkInterpreterLauncher (org.apache.zeppelin.interpreter.launcher.SparkInterpreterLauncher)1 StandardInterpreterLauncher (org.apache.zeppelin.interpreter.launcher.StandardInterpreterLauncher)1 RecoveryStorage (org.apache.zeppelin.interpreter.recovery.RecoveryStorage)1 RemoteInterpreterProcess (org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcess)1