Repository: spark
Updated Branches:
  refs/heads/master 6a7ba1ff7 -> f70e4fff0


[SPARK-14889][SPARK CORE] scala.MatchError: NONE (of class scala.Enumeration) 
when spark.scheduler.mode=NONE

## What changes were proposed in this pull request?

Handling exception for the below mentioned issue

```
➜  spark git:(master) ✗ ./bin/spark-shell -c spark.scheduler.mode=NONE
16/04/25 09:15:00 ERROR SparkContext: Error initializing SparkContext.
scala.MatchError: NONE (of class scala.Enumeration$Val)
        at org.apache.spark.scheduler.Pool.<init>(Pool.scala:53)
        at 
org.apache.spark.scheduler.TaskSchedulerImpl.initialize(TaskSchedulerImpl.scala:131)
        at 
org.apache.spark.SparkContext$.org$apache$spark$SparkContext$$createTaskScheduler(SparkContext.scala:2352)
        at org.apache.spark.SparkContext.<init>(SparkContext.scala:492)
```

The exception now looks like

```
java.lang.RuntimeException: The scheduler mode NONE is not supported by Spark.
```

## How was this patch tested?

manual tests

Author: Subhobrata Dey <[email protected]>

Closes #12666 from sbcd90/schedulerModeIssue.


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

Branch: refs/heads/master
Commit: f70e4fff0e7adb8d6fe774daf11fb0dfb080cf31
Parents: 6a7ba1f
Author: Subhobrata Dey <[email protected]>
Authored: Tue Apr 26 11:46:24 2016 +0100
Committer: Sean Owen <[email protected]>
Committed: Tue Apr 26 11:46:24 2016 +0100

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/scheduler/Pool.scala          | 2 ++
 .../main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala  | 2 ++
 2 files changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/f70e4fff/core/src/main/scala/org/apache/spark/scheduler/Pool.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/scheduler/Pool.scala 
b/core/src/main/scala/org/apache/spark/scheduler/Pool.scala
index 4cd13e2..a79e71e 100644
--- a/core/src/main/scala/org/apache/spark/scheduler/Pool.scala
+++ b/core/src/main/scala/org/apache/spark/scheduler/Pool.scala
@@ -55,6 +55,8 @@ private[spark] class Pool(
         new FairSchedulingAlgorithm()
       case SchedulingMode.FIFO =>
         new FIFOSchedulingAlgorithm()
+      case _ =>
+        throw new IllegalArgumentException(s"Unsupported spark.scheduler.mode: 
$schedulingMode")
     }
   }
 

http://git-wip-us.apache.org/repos/asf/spark/blob/f70e4fff/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 c315918..f31ec2a 100644
--- a/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala
+++ b/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala
@@ -135,6 +135,8 @@ private[spark] class TaskSchedulerImpl(
           new FIFOSchedulableBuilder(rootPool)
         case SchedulingMode.FAIR =>
           new FairSchedulableBuilder(rootPool, conf)
+        case _ =>
+          throw new IllegalArgumentException(s"Unsupported 
spark.scheduler.mode: $schedulingMode")
       }
     }
     schedulableBuilder.buildPools()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to