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

    https://github.com/apache/spark/pull/15237#discussion_r93819357
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/SchedulableBuilder.scala ---
    @@ -102,38 +105,55 @@ private[spark] class FairSchedulableBuilder(val 
rootPool: Pool, conf: SparkConf)
         for (poolNode <- (xml \\ POOLS_PROPERTY)) {
     
           val poolName = (poolNode \ POOL_NAME_PROPERTY).text
    -      var schedulingMode = DEFAULT_SCHEDULING_MODE
    -      var minShare = DEFAULT_MINIMUM_SHARE
    -      var weight = DEFAULT_WEIGHT
     
           val xmlSchedulingMode = (poolNode \ SCHEDULING_MODE_PROPERTY).text
    -      if (xmlSchedulingMode != "") {
    -        try {
    -          schedulingMode = SchedulingMode.withName(xmlSchedulingMode)
    -        } catch {
    -          case e: NoSuchElementException =>
    -            logWarning(s"Unsupported schedulingMode: $xmlSchedulingMode, " 
+
    -              s"using the default schedulingMode: $schedulingMode")
    -        }
    -      }
    +      val schedulingMode = getSchedulingModeValue(xmlSchedulingMode, 
DEFAULT_SCHEDULING_MODE)
     
           val xmlMinShare = (poolNode \ MINIMUM_SHARES_PROPERTY).text
    -      if (xmlMinShare != "") {
    -        minShare = xmlMinShare.toInt
    -      }
    +      val minShare = getIntValue(MINIMUM_SHARES_PROPERTY, xmlMinShare, 
DEFAULT_MINIMUM_SHARE)
     
           val xmlWeight = (poolNode \ WEIGHT_PROPERTY).text
    -      if (xmlWeight != "") {
    -        weight = xmlWeight.toInt
    -      }
    +      val weight = getIntValue(WEIGHT_PROPERTY, xmlWeight, DEFAULT_WEIGHT)
    +
    +      rootPool.addSchedulable(new Pool(poolName, schedulingMode, minShare, 
weight))
     
    -      val pool = new Pool(poolName, schedulingMode, minShare, weight)
    -      rootPool.addSchedulable(pool)
           logInfo("Created pool %s, schedulingMode: %s, minShare: %d, weight: 
%d".format(
             poolName, schedulingMode, minShare, weight))
         }
       }
     
    +  private def getSchedulingModeValue(data: String, defaultValue: 
SchedulingMode): SchedulingMode = {
    --- End diff --
    
    Sure, `trim` and `toUpperCase` functions help to cover for blank and 
invalid `schedulingMode` cases. Also `schedulingMode = none/NONE` case needs to 
be checked. This case is valid but unsupported.


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

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

Reply via email to