diff --git a/core/src/main/scala/org/apache/spark/scheduler/SchedulingMode.scala b/core/src/main/scala/org/apache/spark/scheduler/SchedulingMode.scala index 3832ee7ff6eef..75186b6ba4a41 100644 --- a/core/src/main/scala/org/apache/spark/scheduler/SchedulingMode.scala +++ b/core/src/main/scala/org/apache/spark/scheduler/SchedulingMode.scala @@ -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 } diff --git a/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala b/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala index a3439b525fde1..fe72ab3e43146 100644 --- a/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala +++ b/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala @@ -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)