Skip to content

Commit 3e8134f

Browse files
committed
Clean the states for dynamic allocation disabled situation
1 parent 5d80fac commit 3e8134f

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -351,20 +351,17 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, val rpcEnv: Rp
351351

352352
/**
353353
* Reset the state of CoarseGrainedSchedulerBackend to the initial state. Currently it will only
354-
* be called in the yarn-client mode when AM re-registers after a failure, also dynamic
355-
* allocation is enabled.
354+
* be called in the yarn-client mode when AM re-registers after a failure.
356355
* */
357356
protected def reset(): Unit = synchronized {
358-
if (Utils.isDynamicAllocationEnabled(conf)) {
359-
numPendingExecutors = 0
360-
executorsPendingToRemove.clear()
361-
362-
// Remove all the lingering executors that should be removed but not yet. The reason might be
363-
// because (1) disconnected event is not yet received; (2) executors die silently.
364-
executorDataMap.toMap.foreach { case (eid, _) =>
365-
driverEndpoint.askWithRetry[Boolean](
366-
RemoveExecutor(eid, SlaveLost("Stale executor after cluster manager re-registered.")))
367-
}
357+
numPendingExecutors = 0
358+
executorsPendingToRemove.clear()
359+
360+
// Remove all the lingering executors that should be removed but not yet. The reason might be
361+
// because (1) disconnected event is not yet received; (2) executors die silently.
362+
executorDataMap.toMap.foreach { case (eid, _) =>
363+
driverEndpoint.askWithRetry[Boolean](
364+
RemoveExecutor(eid, SlaveLost("Stale executor after cluster manager re-registered.")))
368365
}
369366
}
370367

0 commit comments

Comments
 (0)