Skip to content

Commit

Permalink
solve the failed test and avoid filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
WangTaoTheTonic committed Sep 8, 2014
1 parent 2ca3091 commit 2835929
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ private[spark] class Master(

// First schedule drivers, they take strict precedence over applications
// Randomization helps balance drivers
val shuffledAliveWorkers = Random.shuffle(workers.filter(_.state == WorkerState.ALIVE))
val shuffledAliveWorkers = Random.shuffle(workers).toArray
val aliveWorkerNum = shuffledAliveWorkers.size
var curPos = aliveWorkerNum - 1
for (driver <- List(waitingDrivers: _*)) {
Expand All @@ -491,7 +491,8 @@ private[spark] class Master(
var launched = false
while (curPos != startFlag && !launched) {
val worker = shuffledAliveWorkers(curPos)
if (worker.memoryFree >= driver.desc.mem && worker.coresFree >= driver.desc.cores) {
if (worker.state == WorkerState.ALIVE
&& worker.memoryFree >= driver.desc.mem && worker.coresFree >= driver.desc.cores) {
launchDriver(worker, driver)
waitingDrivers -= driver
launched = true
Expand Down

0 comments on commit 2835929

Please sign in to comment.