File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
core/src/main/scala/org/apache/spark/deploy/master Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -482,7 +482,7 @@ private[spark] class Master(
482482
483483 // First schedule drivers, they take strict precedence over applications
484484 // Randomization helps balance drivers
485- val shuffledAliveWorkers = Random .shuffle(workers.filter(_.state == WorkerState . ALIVE ))
485+ val shuffledAliveWorkers = Random .shuffle(workers).toArray
486486 val aliveWorkerNum = shuffledAliveWorkers.size
487487 var curPos = aliveWorkerNum - 1
488488 for (driver <- List (waitingDrivers : _* )) {
@@ -491,7 +491,8 @@ private[spark] class Master(
491491 var launched = false
492492 while (curPos != startFlag && ! launched) {
493493 val worker = shuffledAliveWorkers(curPos)
494- if (worker.memoryFree >= driver.desc.mem && worker.coresFree >= driver.desc.cores) {
494+ if (worker.state == WorkerState .ALIVE
495+ && worker.memoryFree >= driver.desc.mem && worker.coresFree >= driver.desc.cores) {
495496 launchDriver(worker, driver)
496497 waitingDrivers -= driver
497498 launched = true
You can’t perform that action at this time.
0 commit comments