Skip to content

Commit e970cb1

Browse files
committed
Avoid adjusting executors requested if we don't any actually changing state.
1 parent 80629eb commit e970cb1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

core/src/main/scala/org/apache/spark/ExecutorAllocationClient.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.spark
1919

2020
import org.apache.spark.scheduler.ExecutorDecommissionInfo
21+
2122
/**
2223
* A client that communicates with the cluster manager to request or kill executors.
2324
* This is currently supported only in YARN mode.

core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,9 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, val rpcEnv: Rp
479479
adjustExecutors(executorsToDecommission.map(_._1))
480480
}
481481

482-
val decommissioned = executorsToDecommission.filter { case (executorId, decomInfo) =>
482+
executorsToDecommission.filter { case (executorId, decomInfo) =>
483483
doDecommission(executorId, decomInfo)
484484
}.map(_._1)
485-
decommissioned
486485
}
487486

488487

@@ -782,6 +781,7 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, val rpcEnv: Rp
782781
* Adjust the number of executors being requested to no longer include the provided executors.
783782
*/
784783
private def adjustExecutors(executorIds: Seq[String]) = {
784+
if (executorIds.nonEmpty) {
785785
executorIds.foreach { exec =>
786786
withLock {
787787
val rpId = executorDataMap(exec).resourceProfileId
@@ -797,6 +797,9 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, val rpcEnv: Rp
797797
}
798798
}
799799
doRequestTotalExecutors(requestedTotalExecutorsPerResourceProfile.toMap)
800+
} else {
801+
Future.successful(true)
802+
}
800803
}
801804

802805
/**

0 commit comments

Comments
 (0)