SPARK-1469: Scheduler mode should accept lower-case definitions and have...

... 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.

Author: Sandeep <sandeep@techaddict.me>

Closes #388 from techaddict/1469 and squashes the following commits:

a31bbd5 [Sandeep] SPARK-1469: Scheduler mode should accept lower-case definitions and have 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.
This commit is contained in:
Sandeep 2014-04-16 09:58:57 -07:00 committed by Patrick Wendell
parent 82349fbd2b
commit e269c24db7
2 changed files with 8 additions and 3 deletions

View file

@ -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
}

View file

@ -99,8 +99,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)