@@ -79,7 +79,6 @@ private[spark] class CoarseGrainedExecutorBackend(
7979 */
8080 private [executor] val taskResources = new mutable.HashMap [Long , Map [String , ResourceInformation ]]
8181
82- // Track our decommissioning status internally.
8382 @ volatile private var decommissioned = false
8483
8584 override def onStart (): Unit = {
@@ -291,7 +290,7 @@ private[spark] class CoarseGrainedExecutorBackend(
291290 // is viewed as acceptable to minimize introduction of any new locking structures in critical
292291 // code paths.
293292
294- val shutdownThread = new Thread ( ) {
293+ val shutdownThread = ThreadUtils .runInNewThread( " wait-for-blocks-to-migrate " ) {
295294 var lastTaskRunningTime = System .nanoTime()
296295 val sleep_time = 1000 // 1s
297296
@@ -300,11 +299,10 @@ private[spark] class CoarseGrainedExecutorBackend(
300299 if (executor == null || executor.numRunningTasks == 0 ) {
301300 if (env.conf.get(STORAGE_DECOMMISSION_ENABLED )) {
302301 logInfo(" No running tasks, checking migrations" )
303- val allBlocksMigrated = env.blockManager.lastMigrationInfo()
302+ val (migrationTime, allBlocksMigrated) = env.blockManager.lastMigrationInfo()
304303 // We can only trust allBlocksMigrated boolean value if there were no tasks running
305304 // since the start of computing it.
306- if (allBlocksMigrated._2 &&
307- (allBlocksMigrated._1 > lastTaskRunningTime)) {
305+ if (allBlocksMigrated && (migrationTime > lastTaskRunningTime)) {
308306 logInfo(" No running tasks, all blocks migrated, stopping." )
309307 exitExecutor(0 , " Finished decommissioning" , notifyDriver = true )
310308 } else {
@@ -316,7 +314,7 @@ private[spark] class CoarseGrainedExecutorBackend(
316314 }
317315 Thread .sleep(sleep_time)
318316 } else {
319- logInfo(" Blocked from shutdown by running task " )
317+ logInfo(" Blocked from shutdown by running ${executor.numRunningtasks} tasks " )
320318 // If there is a running task it could store blocks, so make sure we wait for a
321319 // migration loop to complete after the last task is done.
322320 Thread .sleep(sleep_time)
0 commit comments