use of com.thinkbiganalytics.kylo.spark.model.SessionsPost in project kylo by Teradata.
the class SparkLivyProcessManager method startLivySession.
private Session startLivySession(SparkLivyProcess sparkLivyProcess) {
// it was determined we needed a
sparkLivyProcess.newSession();
JerseyRestClient jerseyClient = getClient(sparkLivyProcess);
Map<String, String> sparkProps = livyProperties.getSparkProperties();
SessionsPost.Builder builder = new SessionsPost.Builder().kind(// "shared" most likely
livyProperties.getLivySessionKind().toString()).conf(// "spark.driver.extraJavaOptions", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8990"
sparkProps);
logger.debug("LivyProperties={}", livyProperties);
if (livyProperties.getProxyUser()) {
String user = processCache.inverse().get(sparkLivyProcess);
if (user != null) {
builder.proxyUser(user);
}
}
SessionsPost sessionsPost = builder.build();
logger.info("sessionsPost={}", sessionsPost);
Session currentSession;
try {
currentSession = livyClient.postSessions(jerseyClient, sessionsPost);
if (currentSession == null) {
logger.error("Server not reachable", new LivyServerNotReachableException("Empty result from LivyClient.postSessions"));
throw new LivyUserException("livy.server_not_found");
}
} catch (LivyException le) {
throw le;
} catch (Exception e) {
// resets the latch
sparkLivyProcess.startFailed();
this.processStopped(sparkLivyProcess);
// NOTE: you can get "javax.ws.rs.ProcessingException: java.io.IOException: Error writing to server" on Ubuntu see: https://stackoverflow.com/a/39718929/154461
throw new LivyException(e);
}
sparkLivyProcess.setSessionId(currentSession.getId());
// notifies listeners
this.processStarted(sparkLivyProcess);
// begin monitoring this session if configured to do so..
heartbeatMonitor.monitorSession(sparkLivyProcess);
return currentSession;
}
Aggregations