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

    https://github.com/apache/spark/pull/18322#discussion_r122942651
  
    --- 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")) {
    --- End diff --
    
    @jerryshao I put the negative check here first, but I think the app should  
exit directly if the cores is  negative, so I move them out. And @srowen thinks 
these checks for negative numbers are redundant with arg checking for 
spark-submit, it may be a good way to move the checkings from spark-submit to 
here.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to