diff options
author | ehnalis <zoltan.zvara@gmail.com> | 2015-05-15 12:14:02 -0700 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2015-05-15 12:15:42 -0700 |
commit | 8e3822a0794b8b18436bd63d6859d40139a77090 (patch) | |
tree | 584a89817d12269898d3d8a3c5164e4c70b40ac5 /core | |
parent | ad92af9dbbd0c4e1224cca26da166382ed4f15b9 (diff) | |
download | spark-8e3822a0794b8b18436bd63d6859d40139a77090.tar.gz spark-8e3822a0794b8b18436bd63d6859d40139a77090.tar.bz2 spark-8e3822a0794b8b18436bd63d6859d40139a77090.zip |
[SPARK-7504] [YARN] NullPointerException when initializing SparkContext in YARN-cluster mode
Added a simple checking for SparkContext.
Also added two rational checking against null at AM object.
Author: ehnalis <zoltan.zvara@gmail.com>
Closes #6083 from ehnalis/cluster and squashes the following commits:
926bd96 [ehnalis] Moved check to SparkContext.
7c89b6e [ehnalis] Remove false line.
ea2a5fe [ehnalis] [SPARK-7504] [YARN] NullPointerException when initializing SparkContext in YARN-cluster mode
4924e01 [ehnalis] [SPARK-7504] [YARN] NullPointerException when initializing SparkContext in YARN-cluster mode
39e4fa3 [ehnalis] SPARK-7504 [YARN] NullPointerException when initializing SparkContext in YARN-cluster mode
9f287c5 [ehnalis] [SPARK-7504] [YARN] NullPointerException when initializing SparkContext in YARN-cluster mode
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/scala/org/apache/spark/SparkContext.scala | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/src/main/scala/org/apache/spark/SparkContext.scala b/core/src/main/scala/org/apache/spark/SparkContext.scala index b59f562d05..af276e7b8d 100644 --- a/core/src/main/scala/org/apache/spark/SparkContext.scala +++ b/core/src/main/scala/org/apache/spark/SparkContext.scala @@ -371,6 +371,14 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli throw new SparkException("An application name must be set in your configuration") } + // System property spark.yarn.app.id must be set if user code ran by AM on a YARN cluster + // yarn-standalone is deprecated, but still supported + if ((master == "yarn-cluster" || master == "yarn-standalone") && + !_conf.contains("spark.yarn.app.id")) { + throw new SparkException("Detected yarn-cluster mode, but isn't running on a cluster. " + + "Deployment to YARN is not supported directly by SparkContext. Please use spark-submit.") + } + if (_conf.getBoolean("spark.logConf", false)) { logInfo("Spark configuration:\n" + _conf.toDebugString) } |