Search in sources :

Example 1 with ClusterManagerServer

use of org.apache.zeppelin.cluster.ClusterManagerServer 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 ClusterManagerServer

use of org.apache.zeppelin.cluster.ClusterManagerServer in project zeppelin by apache.

the class ClusterInterpreterCheckThread method run.

@Override
public void run() {
    LOGGER.info("ClusterInterpreterCheckThread run() >>>");
    ClusterManagerServer clusterServer = ClusterManagerServer.getInstance(ZeppelinConfiguration.create());
    clusterServer.getIntpProcessStatus(intpGroupId, connectTimeout, new ClusterCallback<HashMap<String, Object>>() {

        @Override
        public InterpreterClient online(HashMap<String, Object> result) {
            String intpTSrvHost = (String) result.get(INTP_TSERVER_HOST);
            int intpTSrvPort = (int) result.get(INTP_TSERVER_PORT);
            LOGGER.info("Found cluster interpreter {}:{}", intpTSrvHost, intpTSrvPort);
            if (intpProcess instanceof DockerInterpreterProcess) {
                ((DockerInterpreterProcess) intpProcess).processStarted(intpTSrvPort, intpTSrvHost);
            } else if (intpProcess instanceof ClusterInterpreterProcess) {
                ((ClusterInterpreterProcess) intpProcess).processStarted(intpTSrvPort, intpTSrvHost);
            } else {
                LOGGER.error("Unknown type !");
            }
            return null;
        }

        @Override
        public void offline() {
            LOGGER.error("Can not found cluster interpreter!");
        }
    });
    LOGGER.info("ClusterInterpreterCheckThread run() <<<");
}
Also used : ClusterManagerServer(org.apache.zeppelin.cluster.ClusterManagerServer) HashMap(java.util.HashMap)

Aggregations

ClusterManagerServer (org.apache.zeppelin.cluster.ClusterManagerServer)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 InterpreterSettingManager (org.apache.zeppelin.interpreter.InterpreterSettingManager)1 RecoveryStorage (org.apache.zeppelin.interpreter.recovery.RecoveryStorage)1 AuthorizationService (org.apache.zeppelin.notebook.AuthorizationService)1 NotebookServer (org.apache.zeppelin.socket.NotebookServer)1