Skip to content

ZEPPELIN-270 added env varibles for pyspark's correct function in yarn. - #264

Closed
riverajo wants to merge 1 commit into
apache:gh-pagesfrom
riverajo:gh-pages
Closed

ZEPPELIN-270 added env varibles for pyspark's correct function in yarn.#264
riverajo wants to merge 1 commit into
apache:gh-pagesfrom
riverajo:gh-pages

Conversation

@riverajo

Copy link
Copy Markdown

Simple doc fix for pyspark in yarn.

@felixcheung

Copy link
Copy Markdown
Member

It should build this automatically when SPARK_HOME is defined right?

@Leemoonsoo

Copy link
Copy Markdown
Member

I think PYTHONPATH supposed to build automatically when SPARK_HOME is defined by bin/interpreter.sh. But SPARK_YARN_USER_ENV is not taken care of.

@felixcheung

Copy link
Copy Markdown
Member

Hmm, should we use SparkConf instead then:

https://github.com/apache/spark/blob/69c9c177160e32a2fbc9b36ecc52156077fca6fc/yarn/src/main/scala/org/apache/spark/deploy/yarn/ExecutorRunnable.scala

 // Keep this for backwards compatibility but users should move to the config
sys.env.get("SPARK_YARN_USER_ENV").foreach { userEnvs =>
YarnSparkHadoopUtil.setEnvFromInputString(env, userEnvs)
}

I believe all spark.* in the interpreter settings are passed to SparkConf.

https://github.com/apache/incubator-zeppelin/blob/master/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java

Is this a bug:

 if (!key.startsWith("spark.") || !val.trim().isEmpty()) {
logger.debug(String.format("SparkConf: key = [%s], value = [%s]", key, val));
conf.set(key, val);
}

Shouldn't it say if (key.startsWith("spark.")?

@riverajo

Copy link
Copy Markdown
Author

It should build this automatically when SPARK_HOME is defined right?

That seems right, I didn't need to set PYTHONPATH if SPARK_HOME is set correctly, but I do still need SPARK_YARN_USER_ENV.

However it seems as thought the PYTHONPATH gets created after the zeppelin-env.sh gets run, If I don't set both PYTHONPATH and SPARK_YARN_USER_ENV in that file, It complains that SPARK_YARN_USER_ENV is empty with an array out of bounds exception.

@Leemoonsoo

Copy link
Copy Markdown
Member

@felixcheung

Is this a bug:

if (!key.startsWith("spark.") || !val.trim().isEmpty()) {
logger.debug(String.format("SparkConf: key = [%s], value = [%s]", key, val));
conf.set(key, val);
}

Shouldn't it say if (key.startsWith("spark.")?

I think it's not a bug. Designed to not pass empty value when the key starts with "spark."
This unittest might helpful to understand.
https://github.com/apache/incubator-zeppelin/blob/master/spark/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java#L168

@Leemoonsoo

Copy link
Copy Markdown
Member

Hmm, should we use SparkConf instead then:

https://github.com/apache/spark/blob/69c9c177160e32a2fbc9b36ecc52156077fca6fc/yarn/src/main/scala/org/apache/spark/deploy/yarn/ExecutorRunnable.scala

// Keep this for backwards compatibility but users should move to the config
sys.env.get("SPARK_YARN_USER_ENV").foreach { userEnvs =>
YarnSparkHadoopUtil.setEnvFromInputString(env, userEnvs)
}

I believe all spark.* in the interpreter settings are passed to SparkConf.

How about put the same comment Keep this for backwards compatibility but users should move to the config in the document and proceed?

How about take care zeppelin-env.sh.template, too?

@felixcheung

Copy link
Copy Markdown
Member

@Leemoonsoo good idea.

@corneadoug

Copy link
Copy Markdown
Contributor

@riverajo@felixcheung@Leemoonsoo
Any changes to be done here?
Is this documentation change still needed?

@felixcheung

Copy link
Copy Markdown
Member

I'm not sure if we do but the py4j version changes for the last few Spark releases, so if we do, we would need a way to set the right version as per spark version

@asfgitasfgit closed this in c38a0a0May 9, 2018
asfgit pushed a commit that referenced this pull request May 9, 2018
close#83close#86close#125close#133close#139close#146close#193close#203close#246close#262close#264close#273close#291close#299close#320close#347close#389close#413close#423close#543close#560close#658close#670close#728close#765close#777close#782close#783close#812close#822close#841close#843close#878close#884close#918close#989close#1076close#1135close#1187close#1231close#1304close#1316close#1361close#1385close#1390close#1414close#1422close#1425close#1447close#1458close#1466close#1485close#1492close#1495close#1497close#1536close#1545close#1561close#1577close#1600close#1603close#1678close#1695close#1739close#1748close#1765close#1767close#1776close#1783close#1799
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@riverajo@felixcheung@Leemoonsoo@corneadoug