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");
}
}
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() <<<");
}
Aggregations