mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
handle spark.files correctly for pyspark when spark-submit is used
This commit is contained in:
parent
d4acd1beb8
commit
a8a3440eb2
1 changed files with 8 additions and 2 deletions
|
|
@ -280,7 +280,6 @@ public class SparkInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
//TODO(jongyoul): Move these codes into PySparkInterpreter.java
|
||||
|
||||
String pysparkBasePath = getSystemDefault("SPARK_HOME", "spark.home", null);
|
||||
File pysparkPath;
|
||||
if (null == pysparkBasePath) {
|
||||
|
|
@ -303,10 +302,13 @@ public class SparkInterpreter extends Interpreter {
|
|||
pythonLibUris.trimToSize();
|
||||
if (pythonLibs.length == pythonLibUris.size()) {
|
||||
conf.set("spark.yarn.dist.files", Joiner.on(",").join(pythonLibUris));
|
||||
conf.set("spark.files", conf.get("spark.yarn.dist.files"));
|
||||
if (!useSparkSubmit()) {
|
||||
conf.set("spark.files", conf.get("spark.yarn.dist.files"));
|
||||
}
|
||||
conf.set("spark.submit.pyArchives", Joiner.on(":").join(pythonLibs));
|
||||
}
|
||||
|
||||
|
||||
SparkContext sparkContext = new SparkContext(conf);
|
||||
return sparkContext;
|
||||
}
|
||||
|
|
@ -315,6 +317,10 @@ public class SparkInterpreter extends Interpreter {
|
|||
return (o instanceof String) ? (String) o : "";
|
||||
}
|
||||
|
||||
private boolean useSparkSubmit() {
|
||||
return null != System.getenv("SPARK_HOME");
|
||||
}
|
||||
|
||||
public static String getSystemDefault(
|
||||
String envName,
|
||||
String propertyName,
|
||||
|
|
|
|||
Loading…
Reference in a new issue