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

    https://github.com/apache/spark/pull/18322#discussion_r123461583
  
    --- Diff: core/src/main/scala/org/apache/spark/SparkConf.scala ---
    @@ -543,6 +543,30 @@ class SparkConf(loadDefaults: Boolean) extends 
Cloneable with Logging with Seria
           }
         }
     
    +    if (contains("spark.cores.max")) {
    +      val totalCores = getInt("spark.cores.max", -1)
    +      if (totalCores <= 0) {
    +        throw new IllegalArgumentException(s"spark.cores.max (was 
${get("spark.cores.max")})" +
    +          s" can only be a positive number")
    +      }
    +    }
    +    if (contains("spark.executor.cores")) {
    +      val executorCores = getInt("spark.executor.cores", -1)
    +      if (executorCores <= 0) {
    +        throw new IllegalArgumentException(s"spark.executor.cores " +
    +          s"(was ${get("spark.executor.cores")}) can only be a positive 
number")
    +      }
    +    }
    +    if (contains("spark.cores.max") && contains("spark.executor.cores")) {
    +      val totalCores = getInt("spark.cores.max", 1)
    --- End diff --
    
    @srowen Users may set these configuration via SparkConf object in a 
programmatic way after arg checking for spark-submit. For example, an app code 
may be like this: "val conf = new SparkConf().set("spark.executor.cores","-1")" 
before SparkContext created, the checkings here can get the error and exit 
directly.


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