Skip to content

Commit

Permalink
SPARK-1469: Scheduler mode should accept lower-case definitions and h…
Browse files Browse the repository at this point in the history
…ave nicer error messages

There are  two improvements to Scheduler Mode:
1. Made the built in ones case insensitive (fair/FAIR, fifo/FIFO).
2. If an invalid mode is given we should print a better error message.
  • Loading branch information
techaddict committed Apr 12, 2014
1 parent 7b4203a commit a31bbd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ package org.apache.spark.scheduler
object SchedulingMode extends Enumeration {

type SchedulingMode = Value
val FAIR,FIFO,NONE = Value
val FAIR, FIFO, NONE = Value
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ private[spark] class TaskSchedulerImpl(
var schedulableBuilder: SchedulableBuilder = null
var rootPool: Pool = null
// default scheduler is FIFO
val schedulingMode: SchedulingMode = SchedulingMode.withName(
conf.get("spark.scheduler.mode", "FIFO"))
private val schedulingModeConf = conf.get("spark.scheduler.mode", "FIFO")
val schedulingMode: SchedulingMode = try {
SchedulingMode.withName(schedulingModeConf.toUpperCase)
} catch {
case e: java.util.NoSuchElementException =>
throw new SparkException(s"Urecognized spark.scheduler.mode: $schedulingModeConf")
}

// This is a var so that we can reset it for testing purposes.
private[spark] var taskResultGetter = new TaskResultGetter(sc.env, this)
Expand Down

0 comments on commit a31bbd5

Please sign in to comment.