Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions conf/zeppelin-site.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -718,4 +718,10 @@
Disable it can save lots of memory</description>
</property>

<property>
<name>zeppelin.spark.only_yarn_cluster</name>
<value>false</value>
<description>Whether only allow yarn cluster mode</description>
</property>

</configuration>
2 changes: 2 additions & 0 deletions docs/interpreter/spark.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ For the further information about Spark & Zeppelin version compatibility, please

> Note that without exporting `SPARK_HOME`, it's running in local mode with included version of Spark. The included version may vary depending on the build profile.

> Yarn client mode and local mode will run driver in the same machine with zeppelin server, this would be dangerous for production. Because it may run out of memory when there's many spark interpreters running at the same time. So we suggest you only allow yarn-cluster mode via setting `zeppelin.spark.only_yarn_cluster` in `zeppelin-site.xml`.

## SparkContext, SQLContext, SparkSession, ZeppelinContext

SparkContext, SQLContext, SparkSession (for spark 2.x) and ZeppelinContext are automatically created and exposed as variable names `sc`, `sqlContext`, `spark` and `z`, respectively, in Scala, Kotlin, Python and R environments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,10 @@ public String getZeppelinSearchIndexPath() {
return getRelativeDir(ConfVars.ZEPPELIN_SEARCH_INDEX_PATH);
}

public Boolean isOnlyYarnCluster() {
return getBoolean(ConfVars.ZEPPELIN_SPARK_ONLY_YARN_CLUSTER);
}

public String getClusterAddress() {
return getString(ConfVars.ZEPPELIN_CLUSTER_ADDR);
}
Expand Down Expand Up @@ -998,7 +1002,8 @@ public enum ConfVars {
ZEPPELIN_SEARCH_INDEX_REBUILD("zeppelin.search.index.rebuild", false),
ZEPPELIN_SEARCH_USE_DISK("zeppelin.search.use.disk", true),
ZEPPELIN_SEARCH_INDEX_PATH("zeppelin.search.index.path", "/tmp/zeppelin-index"),
ZEPPELIN_JOBMANAGER_ENABLE("zeppelin.jobmanager.enable", true);
ZEPPELIN_JOBMANAGER_ENABLE("zeppelin.jobmanager.enable", false),
ZEPPELIN_SPARK_ONLY_YARN_CLUSTER("zeppelin.spark.only_yarn_cluster", false);

private String varName;
@SuppressWarnings("rawtypes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public Map<String, String> buildEnvFromProperties(InterpreterLaunchContext conte
if (isYarnMode() && getDeployMode().equals("cluster")) {
env.put("ZEPPELIN_SPARK_YARN_CLUSTER", "true");
sparkProperties.setProperty("spark.yarn.submit.waitAppCompletion", "false");
} else if (zConf.isOnlyYarnCluster()){
throw new IOException("Only yarn-cluster mode is allowed, please set " +
ZeppelinConfiguration.ConfVars.ZEPPELIN_SPARK_ONLY_YARN_CLUSTER.getVarName() +
" to false if you want to use other modes.");
}

StringBuilder sparkConfBuilder = new StringBuilder();
Expand Down