Skip to content

Commit

Permalink
Modified Master to enable schedule normally
Browse files Browse the repository at this point in the history
  • Loading branch information
sarutak committed Sep 17, 2014
1 parent 7d1a372 commit 71e84b6
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -491,14 +491,15 @@ private[spark] class Master(
val shuffledAliveWorkers = Random.shuffle(workers.toSeq.filter(_.state == WorkerState.ALIVE))
val aliveWorkerNum = shuffledAliveWorkers.size
var curPos = 0
var stopPos = -1
for (driver <- waitingDrivers.toList) { // iterate over a copy of waitingDrivers
// We assign workers to each waiting driver in a round-robin fashion. For each driver, we
// start from the last worker that was assigned a driver, and continue onwards until we have
// explored all alive workers.
curPos = (curPos + 1) % aliveWorkerNum
val startPos = curPos
curPos = (stopPos + 1) % aliveWorkerNum
stopPos = curPos + aliveWorkerNum
var launched = false
while (curPos != startPos && !launched) {
while (curPos != stopPos && !launched) {
val worker = shuffledAliveWorkers(curPos)
if (worker.memoryFree >= driver.desc.mem && worker.coresFree >= driver.desc.cores) {
launchDriver(worker, driver)
Expand Down

0 comments on commit 71e84b6

Please sign in to comment.