Ngone51 commented on a change in pull request #32766:
URL: https://github.com/apache/spark/pull/32766#discussion_r645596773
##########
File path:
core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
##########
@@ -478,6 +478,45 @@ class CoarseGrainedSchedulerBackend(scheduler:
TaskSchedulerImpl, val rpcEnv: Rp
protected def minRegisteredRatio: Double = _minRegisteredRatio
+ @GuardedBy("CoarseGrainedSchedulerBackend.this")
+ private val executorsToDecommissionInBatches = new HashSet[String]
+
+ private val executorDecommissionEnabled =
conf.get(config.DECOMMISSION_ENABLED)
+ private var periodicBatchExecutorsDecommissionThread:
Option[ScheduledExecutorService] = None
+ private var periodicBatchExecutorsDecommissionTask:
Option[ScheduledFuture[_]] = None
+
+ if (executorDecommissionEnabled) {
+ /**
+ * Start a thread which runs a task periodically to decommission executors.
+ */
+ val periodicDecommissionIntervalMs =
conf.get(config.EXECUTOR_DECOMMISSION_BATCH_INTERVAL)
+ val batchSize = conf.get(config.EXECUTOR_DECOMMISSION_BATCH_SIZE)
+ periodicBatchExecutorsDecommissionThread =
+ Some(ThreadUtils.newDaemonSingleThreadScheduledExecutor(
+ "periodic-batch-executor-decommission-thread"))
+ periodicBatchExecutorsDecommissionTask = {
+ val scheduledFuture =
+ periodicBatchExecutorsDecommissionThread.get.scheduleAtFixedRate(new
Runnable {
+ override def run(): Unit = Utils.tryLogNonFatalError {
+ // check for executors decommissioning themelves.
+ val numExecutorInDecommissioning =
+ executorsPendingDecommission.size -
executorsToDecommissionInBatches.size
Review comment:
Access on `executorsPendingDecommission` must be protected by
`CoarseGrainedSchedulerBackend`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]