File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
yarn/src/main/scala/org/apache/spark/deploy/yarn Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -315,7 +315,10 @@ object YarnSparkHadoopUtil {
315315 classPathSeparatorField.get(null ).asInstanceOf [String ]
316316 }
317317
318- /** Get the initial target number of executors depends on dynamic allocation is enabled or not */
318+ /**
319+ * Getting the initial target number of executors depends on whether dynamic allocation is
320+ * enabled.
321+ */
319322 def getInitialTargetExecutorNumber (conf : SparkConf ): Int = {
320323 if (Utils .isDynamicAllocationEnabled(conf)) {
321324 val minNumExecutors = conf.getInt(" spark.dynamicAllocation.minExecutors" , 0 )
@@ -328,11 +331,8 @@ object YarnSparkHadoopUtil {
328331
329332 initialNumExecutors
330333 } else {
331- val targetNumExecutors = if (System .getenv(" SPARK_EXECUTOR_INSTANCES" ) != null ) {
332- IntParam .unapply(System .getenv(" SPARK_EXECUTOR_INSTANCES" )).get
333- } else {
334- DEFAULT_NUMBER_EXECUTORS
335- }
334+ val targetNumExecutors =
335+ sys.env.get(" SPARK_EXECUTOR_INSTANCES" ).map(_.toInt).getOrElse(DEFAULT_NUMBER_EXECUTORS )
336336 // System property can override environment variable.
337337 conf.getInt(" spark.executor.instances" , targetNumExecutors)
338338 }
You can’t perform that action at this time.
0 commit comments