Github user pwendell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/388#discussion_r11558664
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala ---
    @@ -98,8 +98,12 @@ 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"))
    +  val schedulingMode: SchedulingMode = try {
    +    SchedulingMode.withName(conf.get("spark.scheduler.mode", 
"FIFO").toUpperCase)
    +  } catch {
    +    case e: java.util.NoSuchElementException =>
    +      throw new SparkException("spark scheduler mode not available", e)
    --- End diff --
    
    This is a good start, but if you look at the JIRA, this exception won't 
actually echo back to the user the name they provided, which is bad form. I 
think you should capture the argument the user provided first then echo it back 
to them:
    
    ```
    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"unrecognized spark.scheduler.mode: 
$schedulingModeConf")
      }
    ```
    Don't even bother re-sending the NoSuchElementException... it doesn't 
convey anything useful to the user.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to