File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
core/src/main/scala/org/apache/spark Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -449,14 +449,6 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging {
449449 }
450450 }
451451
452- // System property spark.yarn.app.id must be set if user code ran by AM on a YARN cluster
453- // yarn-standalone is deprecated, but still supported
454- if ((get(" spark.master" ) == " yarn-cluster" || get(" spark.master" ) == " yarn-standalone" ) &&
455- get(" spark.yarn.app.id" , null ) == null ) {
456- throw new SparkException (" Detected yarn-cluster mode, but isn't running on a cluster. " +
457- " Deployment to YARN is not supported directly by SparkContext. Please use spark-submit." )
458- }
459-
460452 }
461453
462454 /**
Original file line number Diff line number Diff line change @@ -371,6 +371,14 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli
371371 throw new SparkException (" An application name must be set in your configuration" )
372372 }
373373
374+ // System property spark.yarn.app.id must be set if user code ran by AM on a YARN cluster
375+ // yarn-standalone is deprecated, but still supported
376+ if ((master == " yarn-cluster" || master == " yarn-standalone" ) &&
377+ ! _conf.contains(" spark.yarn.app.id" )) {
378+ throw new SparkException (" Detected yarn-cluster mode, but isn't running on a cluster. " +
379+ " Deployment to YARN is not supported directly by SparkContext. Please use spark-submit." )
380+ }
381+
374382 if (_conf.getBoolean(" spark.logConf" , false )) {
375383 logInfo(" Spark configuration:\n " + _conf.toDebugString)
376384 }
You can’t perform that action at this time.
0 commit comments