use of org.apache.zeppelin.interpreter.remote.ExecRemoteInterpreterProcess in project zeppelin by apache.
the class SparkInterpreterLauncherTest method testConnectTimeOut.
@Test
public void testConnectTimeOut() throws IOException {
ZeppelinConfiguration zConf = ZeppelinConfiguration.create();
SparkInterpreterLauncher launcher = new SparkInterpreterLauncher(zConf, null);
Properties properties = new Properties();
properties.setProperty("SPARK_HOME", sparkHome);
properties.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT.getVarName(), "10000");
InterpreterOption option = new InterpreterOption();
option.setUserImpersonate(true);
InterpreterLaunchContext context = new InterpreterLaunchContext(properties, option, null, "user1", "intpGroupId", "groupId", "groupName", "name", 0, "host");
InterpreterClient client = launcher.launch(context);
assertTrue(client instanceof ExecRemoteInterpreterProcess);
ExecRemoteInterpreterProcess interpreterProcess = (ExecRemoteInterpreterProcess) client;
assertEquals("name", interpreterProcess.getInterpreterSettingName());
assertEquals(zeppelinHome + "/interpreter/groupName", interpreterProcess.getInterpreterDir());
assertEquals(zeppelinHome + "/local-repo/groupId", interpreterProcess.getLocalRepoDir());
assertEquals(10000, interpreterProcess.getConnectTimeout());
assertEquals(zConf.getInterpreterRemoteRunnerPath(), interpreterProcess.getInterpreterRunner());
assertTrue(interpreterProcess.getEnv().size() >= 2);
assertEquals(true, interpreterProcess.isUserImpersonated());
}
use of org.apache.zeppelin.interpreter.remote.ExecRemoteInterpreterProcess in project zeppelin by apache.
the class SparkInterpreterLauncherTest method testYarnClusterMode_2.
@Test
public void testYarnClusterMode_2() throws IOException {
ZeppelinConfiguration zConf = ZeppelinConfiguration.create();
SparkInterpreterLauncher launcher = new SparkInterpreterLauncher(zConf, null);
Properties properties = new Properties();
properties.setProperty("SPARK_HOME", sparkHome);
properties.setProperty("property_1", "value_1");
properties.setProperty("spark.master", "yarn");
properties.setProperty("spark.submit.deployMode", "cluster");
properties.setProperty("spark.files", "file_1");
properties.setProperty("spark.jars", "jar_1");
InterpreterOption option = new InterpreterOption();
option.setUserImpersonate(true);
InterpreterLaunchContext context = new InterpreterLaunchContext(properties, option, null, "user1", "intpGroupId", "groupId", "spark", "spark", 0, "host");
Path localRepoPath = Paths.get(zConf.getInterpreterLocalRepoPath(), context.getInterpreterSettingId());
FileUtils.deleteDirectory(localRepoPath.toFile());
Files.createDirectories(localRepoPath);
Files.createFile(Paths.get(localRepoPath.toAbsolutePath().toString(), "test.jar"));
InterpreterClient client = launcher.launch(context);
assertTrue(client instanceof ExecRemoteInterpreterProcess);
ExecRemoteInterpreterProcess interpreterProcess = (ExecRemoteInterpreterProcess) client;
assertEquals("spark", interpreterProcess.getInterpreterSettingName());
assertTrue(interpreterProcess.getInterpreterDir().endsWith("/interpreter/spark"));
assertTrue(interpreterProcess.getLocalRepoDir().endsWith("/local-repo/groupId"));
assertEquals(zConf.getInterpreterRemoteRunnerPath(), interpreterProcess.getInterpreterRunner());
assertTrue(interpreterProcess.getEnv().size() >= 3);
assertEquals(sparkHome, interpreterProcess.getEnv().get("SPARK_HOME"));
assertEquals("true", interpreterProcess.getEnv().get("ZEPPELIN_SPARK_YARN_CLUSTER"));
String sparkJars = "jar_1," + Paths.get(localRepoPath.toAbsolutePath().toString(), "test.jar").toString() + "," + zeppelinHome + "/interpreter/spark/scala-2.11/spark-scala-2.11-" + Util.getVersion() + ".jar," + zeppelinHome + "/interpreter/zeppelin-interpreter-shaded-" + Util.getVersion() + ".jar";
String sparkrZip = sparkHome + "/R/lib/sparkr.zip#sparkr";
String sparkFiles = "file_1," + zeppelinHome + "/conf/log4j_yarn_cluster.properties";
assertEquals("--proxy-user|user1|--conf|spark.yarn.dist.archives=" + sparkrZip + "|--conf|spark.yarn.isPython=true|--conf|spark.app.name=intpGroupId" + "|--conf|spark.yarn.maxAppAttempts=1" + "|--conf|spark.master=yarn" + "|--conf|spark.files=" + sparkFiles + "|--conf|spark.jars=" + sparkJars + "|--conf|spark.submit.deployMode=cluster" + "|--conf|spark.yarn.submit.waitAppCompletion=false", interpreterProcess.getEnv().get("ZEPPELIN_SPARK_CONF"));
Files.deleteIfExists(Paths.get(localRepoPath.toAbsolutePath().toString(), "test.jar"));
FileUtils.deleteDirectory(localRepoPath.toFile());
}
use of org.apache.zeppelin.interpreter.remote.ExecRemoteInterpreterProcess in project zeppelin by apache.
the class StandardInterpreterLauncherTest method testConnectTimeOut.
@Test
public void testConnectTimeOut() throws IOException {
ZeppelinConfiguration zConf = ZeppelinConfiguration.create();
StandardInterpreterLauncher launcher = new StandardInterpreterLauncher(zConf, null);
Properties properties = new Properties();
properties.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT.getVarName(), "10000");
InterpreterOption option = new InterpreterOption();
option.setUserImpersonate(true);
InterpreterLaunchContext context = new InterpreterLaunchContext(properties, option, null, "user1", "intpGroupId", "groupId", "groupName", "name", 0, "host");
InterpreterClient client = launcher.launch(context);
assertTrue(client instanceof ExecRemoteInterpreterProcess);
ExecRemoteInterpreterProcess interpreterProcess = (ExecRemoteInterpreterProcess) client;
assertEquals("name", interpreterProcess.getInterpreterSettingName());
assertEquals(".//interpreter/groupName", interpreterProcess.getInterpreterDir());
assertEquals(".//local-repo/groupId", interpreterProcess.getLocalRepoDir());
assertEquals(10000, interpreterProcess.getConnectTimeout());
assertEquals(zConf.getInterpreterRemoteRunnerPath(), interpreterProcess.getInterpreterRunner());
assertTrue(interpreterProcess.getEnv().size() >= 1);
assertTrue(interpreterProcess.getEnv().containsKey("INTERPRETER_GROUP_ID"));
assertEquals(true, interpreterProcess.isUserImpersonated());
}
use of org.apache.zeppelin.interpreter.remote.ExecRemoteInterpreterProcess in project zeppelin by apache.
the class StandardInterpreterLauncher method launchDirectly.
@Override
public InterpreterClient launchDirectly(InterpreterLaunchContext context) throws IOException {
LOGGER.info("Launching new interpreter process of {}", context.getInterpreterSettingGroup());
this.properties = context.getProperties();
InterpreterOption option = context.getOption();
InterpreterRunner runner = context.getRunner();
String groupName = context.getInterpreterSettingGroup();
String name = context.getInterpreterSettingName();
int connectTimeout = getConnectTimeout();
int connectionPoolSize = getConnectPoolSize();
if (option.isExistingProcess()) {
return new RemoteInterpreterRunningProcess(context.getInterpreterSettingName(), context.getInterpreterGroupId(), connectTimeout, connectionPoolSize, context.getIntpEventServerHost(), context.getIntpEventServerPort(), option.getHost(), option.getPort(), false);
} else {
// create new remote process
String localRepoPath = zConf.getInterpreterLocalRepoPath() + File.separator + context.getInterpreterSettingId();
return new ExecRemoteInterpreterProcess(context.getIntpEventServerPort(), context.getIntpEventServerHost(), zConf.getInterpreterPortRange(), zConf.getInterpreterDir() + "/" + groupName, localRepoPath, buildEnvFromProperties(context), connectTimeout, connectionPoolSize, name, context.getInterpreterGroupId(), option.isUserImpersonate(), runner != null ? runner.getPath() : zConf.getInterpreterRemoteRunnerPath());
}
}
use of org.apache.zeppelin.interpreter.remote.ExecRemoteInterpreterProcess in project zeppelin by apache.
the class SparkInterpreterLauncherTest method testYarnClusterMode_1.
@Test
public void testYarnClusterMode_1() throws IOException {
ZeppelinConfiguration zConf = ZeppelinConfiguration.create();
SparkInterpreterLauncher launcher = new SparkInterpreterLauncher(zConf, null);
Properties properties = new Properties();
properties.setProperty("SPARK_HOME", sparkHome);
properties.setProperty("property_1", "value_1");
properties.setProperty("spark.master", "yarn-cluster");
properties.setProperty("spark.files", "file_1");
properties.setProperty("spark.jars", "jar_1");
InterpreterOption option = new InterpreterOption();
InterpreterLaunchContext context = new InterpreterLaunchContext(properties, option, null, "user1", "intpGroupId", "groupId", "spark", "spark", 0, "host");
InterpreterClient client = launcher.launch(context);
assertTrue(client instanceof ExecRemoteInterpreterProcess);
ExecRemoteInterpreterProcess interpreterProcess = (ExecRemoteInterpreterProcess) client;
assertEquals("spark", interpreterProcess.getInterpreterSettingName());
assertTrue(interpreterProcess.getInterpreterDir().endsWith("/interpreter/spark"));
assertTrue(interpreterProcess.getLocalRepoDir().endsWith("/local-repo/groupId"));
assertEquals(zConf.getInterpreterRemoteRunnerPath(), interpreterProcess.getInterpreterRunner());
assertTrue(interpreterProcess.getEnv().size() >= 3);
assertEquals(sparkHome, interpreterProcess.getEnv().get("SPARK_HOME"));
assertEquals("true", interpreterProcess.getEnv().get("ZEPPELIN_SPARK_YARN_CLUSTER"));
String sparkJars = "jar_1," + zeppelinHome + "/interpreter/spark/scala-2.11/spark-scala-2.11-" + Util.getVersion() + ".jar," + zeppelinHome + "/interpreter/zeppelin-interpreter-shaded-" + Util.getVersion() + ".jar";
String sparkrZip = sparkHome + "/R/lib/sparkr.zip#sparkr";
String sparkFiles = "file_1," + zeppelinHome + "/conf/log4j_yarn_cluster.properties";
assertEquals("--conf|spark.yarn.dist.archives=" + sparkrZip + "|--conf|spark.yarn.maxAppAttempts=1" + "|--conf|spark.files=" + sparkFiles + "|--conf|spark.jars=" + sparkJars + "|--conf|spark.yarn.isPython=true" + "|--conf|spark.yarn.submit.waitAppCompletion=false" + "|--conf|spark.app.name=intpGroupId" + "|--conf|spark.master=yarn-cluster", interpreterProcess.getEnv().get("ZEPPELIN_SPARK_CONF"));
}
Aggregations