Github user jerryshao commented on a diff in the pull request: https://github.com/apache/spark/pull/18322#discussion_r122927744 --- 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 -- I think we could move the negative check to here to simplify the code.
--- 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