srowen commented on a change in pull request #24131: [SPARK-27192][Core] 
spark.task.cpus should be less or equal than spark.executor.cores
URL: https://github.com/apache/spark/pull/24131#discussion_r270104317
 
 

 ##########
 File path: core/src/test/scala/org/apache/spark/SparkContextSuite.scala
 ##########
 @@ -710,6 +710,24 @@ class SparkContextSuite extends SparkFunSuite with 
LocalSparkContext with Eventu
       assert(runningTaskIds.isEmpty)
     }
   }
+
+  Seq(
+    ("local", 2, None),
+    ("local[2]", 3, None),
+    ("local[2, 1]", 3, None),
+    ("spark://test-spark-cluster", 2, Option(1)),
+    ("local-cluster[1, 1, 1000]", 2, Option(1)),
+    ("yarn", 2, Option(1))
+  ).foreach {
+    case (master, cpusPerTask, executorCores) =>
+      test(s"Avoid setting ${CPUS_PER_TASK.key} unreasonably when run on 
$master (SPARK-27192)") {
+        val conf = new SparkConf()
+        conf.set("master", master)
+        conf.set(CPUS_PER_TASK, cpusPerTask)
+        executorCores.map(executorCores => conf.set(EXECUTOR_CORES, 
executorCores))
+        intercept[SparkException] {sc = new SparkContext(conf)}
 
 Review comment:
   Break the body onto a new line. Also, can you assert that the message 
contains a short substring that indicates the error is the expected one?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to