@@ -80,16 +80,16 @@ private[spark] class ExecutorAllocationManager(
8080 Integer .MAX_VALUE )
8181
8282 // How long there must be backlogged tasks for before an addition is triggered (seconds)
83- private val schedulerBacklogTimeout = conf.getLong (
84- " spark.dynamicAllocation.schedulerBacklogTimeout" , 5 )
83+ private val schedulerBacklogTimeoutS = conf.getTimeAsSeconds (
84+ " spark.dynamicAllocation.schedulerBacklogTimeout" , " 5s " )
8585
86- // Same as above, but used only after `schedulerBacklogTimeout ` is exceeded
87- private val sustainedSchedulerBacklogTimeout = conf.getLong (
88- " spark.dynamicAllocation.sustainedSchedulerBacklogTimeout" , schedulerBacklogTimeout )
86+ // Same as above, but used only after `schedulerBacklogTimeoutS ` is exceeded
87+ private val sustainedSchedulerBacklogTimeoutS = conf.getTimeAsSeconds (
88+ " spark.dynamicAllocation.sustainedSchedulerBacklogTimeout" , s " ${schedulerBacklogTimeoutS} s " )
8989
9090 // How long an executor must be idle for before it is removed (seconds)
91- private val executorIdleTimeout = conf.getLong (
92- " spark.dynamicAllocation.executorIdleTimeout" , 600 )
91+ private val executorIdleTimeoutS = conf.getTimeAsSeconds (
92+ " spark.dynamicAllocation.executorIdleTimeout" , " 600s " )
9393
9494 // During testing, the methods to actually kill and add executors are mocked out
9595 private val testing = conf.getBoolean(" spark.dynamicAllocation.testing" , false )
@@ -150,14 +150,14 @@ private[spark] class ExecutorAllocationManager(
150150 throw new SparkException (s " spark.dynamicAllocation.minExecutors ( $minNumExecutors) must " +
151151 s " be less than or equal to spark.dynamicAllocation.maxExecutors ( $maxNumExecutors)! " )
152152 }
153- if (schedulerBacklogTimeout <= 0 ) {
153+ if (schedulerBacklogTimeoutS <= 0 ) {
154154 throw new SparkException (" spark.dynamicAllocation.schedulerBacklogTimeout must be > 0!" )
155155 }
156- if (sustainedSchedulerBacklogTimeout <= 0 ) {
156+ if (sustainedSchedulerBacklogTimeoutS <= 0 ) {
157157 throw new SparkException (
158158 " spark.dynamicAllocation.sustainedSchedulerBacklogTimeout must be > 0!" )
159159 }
160- if (executorIdleTimeout <= 0 ) {
160+ if (executorIdleTimeoutS <= 0 ) {
161161 throw new SparkException (" spark.dynamicAllocation.executorIdleTimeout must be > 0!" )
162162 }
163163 // Require external shuffle service for dynamic allocation
@@ -262,8 +262,8 @@ private[spark] class ExecutorAllocationManager(
262262 } else if (addTime != NOT_SET && now >= addTime) {
263263 val delta = addExecutors(maxNeeded)
264264 logDebug(s " Starting timer to add more executors (to " +
265- s " expire in $sustainedSchedulerBacklogTimeout seconds) " )
266- addTime += sustainedSchedulerBacklogTimeout * 1000
265+ s " expire in $sustainedSchedulerBacklogTimeoutS seconds) " )
266+ addTime += sustainedSchedulerBacklogTimeoutS * 1000
267267 delta
268268 } else {
269269 0
@@ -351,7 +351,7 @@ private[spark] class ExecutorAllocationManager(
351351 val removeRequestAcknowledged = testing || client.killExecutor(executorId)
352352 if (removeRequestAcknowledged) {
353353 logInfo(s " Removing executor $executorId because it has been idle for " +
354- s " $executorIdleTimeout seconds (new desired total will be ${numExistingExecutors - 1 }) " )
354+ s " $executorIdleTimeoutS seconds (new desired total will be ${numExistingExecutors - 1 }) " )
355355 executorsPendingToRemove.add(executorId)
356356 true
357357 } else {
@@ -407,8 +407,8 @@ private[spark] class ExecutorAllocationManager(
407407 private def onSchedulerBacklogged (): Unit = synchronized {
408408 if (addTime == NOT_SET ) {
409409 logDebug(s " Starting timer to add executors because pending tasks " +
410- s " are building up (to expire in $schedulerBacklogTimeout seconds) " )
411- addTime = clock.getTimeMillis + schedulerBacklogTimeout * 1000
410+ s " are building up (to expire in $schedulerBacklogTimeoutS seconds) " )
411+ addTime = clock.getTimeMillis + schedulerBacklogTimeoutS * 1000
412412 }
413413 }
414414
@@ -431,8 +431,8 @@ private[spark] class ExecutorAllocationManager(
431431 if (executorIds.contains(executorId)) {
432432 if (! removeTimes.contains(executorId) && ! executorsPendingToRemove.contains(executorId)) {
433433 logDebug(s " Starting idle timer for $executorId because there are no more tasks " +
434- s " scheduled to run on the executor (to expire in $executorIdleTimeout seconds) " )
435- removeTimes(executorId) = clock.getTimeMillis + executorIdleTimeout * 1000
434+ s " scheduled to run on the executor (to expire in $executorIdleTimeoutS seconds) " )
435+ removeTimes(executorId) = clock.getTimeMillis + executorIdleTimeoutS * 1000
436436 }
437437 } else {
438438 logWarning(s " Attempted to mark unknown executor $executorId idle " )
0 commit comments