Skip to content

Commit d53d5c8

Browse files
committed
Comment and style changes
1 parent e6547fb commit d53d5c8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnSparkHadoopUtil.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)