Skip to content

Commit

Permalink
[SPARK-8646] PySpark does not run on YARN if master not provided in c…
Browse files Browse the repository at this point in the history
…ommand line

andrewor14 davies vanzin can you take a look at this? thanks

Author: Lianhui Wang <lianhuiwang09@gmail.com>

Closes #7438 from lianhuiwang/SPARK-8646 and squashes the following commits:

cb3f12d [Lianhui Wang] add whitespace
6d874a6 [Lianhui Wang] support pyspark for yarn-client
  • Loading branch information
lianhuiwang authored and Andrew Or committed Jul 17, 2015
1 parent 57e9b13 commit 49351c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions python/pyspark/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ def _do_init(self, master, appName, sparkHome, pyFiles, environment, batchSize,
self.master = self._conf.get("spark.master")
self.appName = self._conf.get("spark.app.name")
self.sparkHome = self._conf.get("spark.home", None)

# Let YARN know it's a pyspark app, so it distributes needed libraries.
if self.master == "yarn-client":
self._conf.set("spark.yarn.isPython", "true")

for (k, v) in self._conf.getAll():
if k.startswith("spark.executorEnv."):
varName = k[len("spark.executorEnv."):]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ private[spark] class Client(
val appId = newAppResponse.getApplicationId
val appStagingDir = getAppStagingDir(appId)
val pySparkArchives =
if (sys.props.getOrElse("spark.yarn.isPython", "false").toBoolean) {
if (sparkConf.getBoolean("spark.yarn.isPython", false)) {
findPySparkArchives()
} else {
Nil
Expand Down

0 comments on commit 49351c7

Please sign in to comment.