You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/15 21:38:56 UTC

[GitHub] [spark] vanzin commented on a change in pull request #24989: [SPARK-27959][YARN][test-hadoop3.2] Change YARN resource configs to use .amount

vanzin commented on a change in pull request #24989: [SPARK-27959][YARN][test-hadoop3.2] Change YARN resource configs to use .amount
URL: https://github.com/apache/spark/pull/24989#discussion_r303646045
 
 

 ##########
 File path: resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/ResourceRequestHelperSuite.scala
 ##########
 @@ -50,7 +54,53 @@ class ResourceRequestHelperSuite extends SparkFunSuite with Matchers {
     sparkConf.set(DRIVER_CORES.key, "4")
     sparkConf.set(EXECUTOR_MEMORY.key, "4G")
     sparkConf.set(EXECUTOR_CORES.key, "2")
-    ResourceRequestHelper.validateResources(sparkConf)
+    validateResources(sparkConf)
+  }
+
+  test("get yarn resources from configs") {
+    val sparkConf = new SparkConf()
+    val resources = Map(YARN_GPU_RESOURCE_CONFIG -> "2G",
+      YARN_FPGA_RESOURCE_CONFIG -> "3G", "custom" -> "4")
+    resources.foreach { case (name, value) =>
+      sparkConf.set(s"${YARN_EXECUTOR_RESOURCE_TYPES_PREFIX}${name}.${AMOUNT}", value)
+      sparkConf.set(s"${YARN_DRIVER_RESOURCE_TYPES_PREFIX}${name}.${AMOUNT}", value)
+      sparkConf.set(s"${YARN_AM_RESOURCE_TYPES_PREFIX}${name}.${AMOUNT}", value)
+    }
+    var parsedResources = getYarnResourcesAndAmounts(sparkConf, YARN_EXECUTOR_RESOURCE_TYPES_PREFIX)
+    assert(resources.size === 3)
 
 Review comment:
   I find that these tests generally fail with a very unhelpful message.
   
   Since `getYarnResourcesAndAmounts` returns a map, isn't this + the check below basically the same as:
   
       assert(parsedResources === resources)
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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