Repository: spark
Updated Branches:
  refs/heads/branch-1.0 4479ecd08 -> b75301f1f


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 <[email protected]>

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.
(cherry picked from commit e269c24db7882ba05b26eff8fc6e1869103517f8)

Signed-off-by: Patrick Wendell <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/b75301f1
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/b75301f1
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/b75301f1

Branch: refs/heads/branch-1.0
Commit: b75301f1f9d13051601d9e43623572931072dce2
Parents: 4479ecd
Author: Sandeep <[email protected]>
Authored: Wed Apr 16 09:58:57 2014 -0700
Committer: Patrick Wendell <[email protected]>
Committed: Wed Apr 16 09:59:03 2014 -0700

----------------------------------------------------------------------
 .../scala/org/apache/spark/scheduler/SchedulingMode.scala   | 2 +-
 .../org/apache/spark/scheduler/TaskSchedulerImpl.scala      | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/b75301f1/core/src/main/scala/org/apache/spark/scheduler/SchedulingMode.scala
----------------------------------------------------------------------
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 3832ee7..75186b6 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
 }

http://git-wip-us.apache.org/repos/asf/spark/blob/b75301f1/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala
----------------------------------------------------------------------
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 a3439b5..fe72ab3 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)

Reply via email to