You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by vanzin <gi...@git.apache.org> on 2018/10/16 20:26:04 UTC
[GitHub] spark pull request #22751: [SPARK-20327][yarn] Follow up: fix resource reque...
GitHub user vanzin opened a pull request:
https://github.com/apache/spark/pull/22751
[SPARK-20327][yarn] Follow up: fix resource request tests on Hadoop 3.
The test fix is to allocate a `Resource` object only after the resource
types have been initialized. Otherwise the YARN classes get in a weird
state and throw a different exception than expected, because the resource
has a different view of the registered resources.
I also removed a test for a null resource since that seems unnecessary
and made the fix more complicated.
All the other changes are just cleanup; basically simplify the tests by
defining what is being tested and deriving the resource type registration
and the SparkConf from that data, instead of having redundant definitions
in the tests.
Ran tests with Hadoop 3 (and also without it).
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/vanzin/spark SPARK-20327.fix
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/22751.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #22751
----
commit 5642f3aa5de1d069ad7e1741213a0be81f2518b6
Author: Marcelo Vanzin <va...@...>
Date: 2018-10-16T19:58:45Z
[SPARK-20327][yarn] Follow up: fix resource request tests on Hadoop 3.
The test fix is to allocate a `Resource` object only after the resource
types have been initialized. Otherwise the YARN classes get in a weird
state and throw a different exception than expected, because the resource
has a different view of the registered resources.
I also removed a test for a null resource since that seems unnecessary
and made the fix more complicated.
All the other changes are just cleanup; basically simplify the tests by
defining what is being tested and deriving the resource type registration
and the SparkConf from that data, instead of having redundant definitions
in the tests.
Ran tests with Hadoop 3 (and also without it).
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22751: [SPARK-20327][yarn] Follow up: fix resource request test...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/22751
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #22751: [SPARK-20327][yarn] Follow up: fix resource reque...
Posted by squito <gi...@git.apache.org>.
Github user squito commented on a diff in the pull request:
https://github.com/apache/spark/pull/22751#discussion_r225707336
--- Diff: resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/ClientSuite.scala ---
@@ -372,6 +358,35 @@ class ClientSuite extends SparkFunSuite with Matchers {
sparkConf.get(SECONDARY_JARS) should be (Some(Seq(new File(jar2.toURI).getName)))
}
+ Seq(
+ "client" -> YARN_AM_RESOURCE_TYPES_PREFIX,
+ "cluster" -> YARN_DRIVER_RESOURCE_TYPES_PREFIX
+ ).foreach { case (deployMode, prefix) =>
+ test(s"custom resource request ($deployMode mode)") {
+ assume(ResourceRequestHelper.isYarnResourceTypesAvailable())
+ val resources = Map("fpga" -> 2, "gpu" -> 3)
+ ResourceRequestTestHelper.initializeResourceTypes(resources.keys.toSeq)
+
+ val conf = new SparkConf().set("spark.submit.deployMode", deployMode)
+ resources.foreach { case (name, v) =>
+ conf.set(prefix + name, v.toString)
+ }
+
+ val appContext = Records.newRecord(classOf[ApplicationSubmissionContext])
+ val getNewApplicationResponse = Records.newRecord(classOf[GetNewApplicationResponse])
+ val containerLaunchContext = Records.newRecord(classOf[ContainerLaunchContext])
+
+ val client = new Client(new ClientArguments(Array()), conf)
--- End diff --
is this where you're reordering things? All I see is `ClientArguments` is initialized later ...
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22751: [SPARK-20327][yarn] Follow up: fix resource request test...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/22751
**[Test build #97470 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/97470/testReport)** for PR 22751 at commit [`5642f3a`](https://github.com/apache/spark/commit/5642f3aa5de1d069ad7e1741213a0be81f2518b6).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22751: [SPARK-20327][yarn] Follow up: fix resource request test...
Posted by squito <gi...@git.apache.org>.
Github user squito commented on the issue:
https://github.com/apache/spark/pull/22751
merged to master
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #22751: [SPARK-20327][yarn] Follow up: fix resource reque...
Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/22751#discussion_r225708545
--- Diff: resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/ClientSuite.scala ---
@@ -372,6 +358,35 @@ class ClientSuite extends SparkFunSuite with Matchers {
sparkConf.get(SECONDARY_JARS) should be (Some(Seq(new File(jar2.toURI).getName)))
}
+ Seq(
+ "client" -> YARN_AM_RESOURCE_TYPES_PREFIX,
+ "cluster" -> YARN_DRIVER_RESOURCE_TYPES_PREFIX
+ ).foreach { case (deployMode, prefix) =>
+ test(s"custom resource request ($deployMode mode)") {
+ assume(ResourceRequestHelper.isYarnResourceTypesAvailable())
+ val resources = Map("fpga" -> 2, "gpu" -> 3)
+ ResourceRequestTestHelper.initializeResourceTypes(resources.keys.toSeq)
+
+ val conf = new SparkConf().set("spark.submit.deployMode", deployMode)
+ resources.foreach { case (name, v) =>
+ conf.set(prefix + name, v.toString)
+ }
+
+ val appContext = Records.newRecord(classOf[ApplicationSubmissionContext])
+ val getNewApplicationResponse = Records.newRecord(classOf[GetNewApplicationResponse])
+ val containerLaunchContext = Records.newRecord(classOf[ContainerLaunchContext])
+
+ val client = new Client(new ClientArguments(Array()), conf)
--- End diff --
no, I'll comment on where the fix was.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22751: [SPARK-20327][yarn] Follow up: fix resource request test...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/22751
**[Test build #97470 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/97470/testReport)** for PR 22751 at commit [`5642f3a`](https://github.com/apache/spark/commit/5642f3aa5de1d069ad7e1741213a0be81f2518b6).
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22751: [SPARK-20327][yarn] Follow up: fix resource request test...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/22751
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/97470/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22751: [SPARK-20327][yarn] Follow up: fix resource request test...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/22751
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #22751: [SPARK-20327][yarn] Follow up: fix resource request test...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/22751
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution-unified/4046/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #22751: [SPARK-20327][yarn] Follow up: fix resource reque...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/spark/pull/22751
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #22751: [SPARK-20327][yarn] Follow up: fix resource reque...
Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/22751#discussion_r225708901
--- Diff: resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/ResourceRequestHelperSuite.scala ---
@@ -163,52 +134,6 @@ class ResourceRequestHelperSuite extends SparkFunSuite with Matchers {
include(NEW_CONFIG_DRIVER_MEMORY))
}
- private def verifySetResourceRequestsSuccessful(
- definedResourceTypes: List[String],
- resourceRequests: Map[String, String],
- expectedResources: Map[String, ResourceInformation]): Unit = {
- assume(ResourceRequestHelper.isYarnResourceTypesAvailable())
- ResourceRequestTestHelper.initializeResourceTypes(definedResourceTypes)
-
- val resource = createResource()
- ResourceRequestHelper.setResourceRequests(resourceRequests, resource)
-
- expectedResources.foreach { case (name, ri) =>
- val resourceInfo = ResourceRequestTestHelper.getResourceInformationByName(resource, name)
- assert(resourceInfo === ri)
- }
- }
-
- private def verifySetResourceRequestsException(
- definedResourceTypes: List[String],
- resourceRequests: Map[String, String],
- message: String): Unit = {
- val resource = createResource()
- verifySetResourceRequestsException(definedResourceTypes, resource, resourceRequests, message)
- }
-
- private def verifySetResourceRequestsException(
- definedResourceTypes: List[String],
- resource: Resource,
--- End diff --
This is what caused the error, couple with the call to `initializeResourceTypes` below. The request object would have a different internal view of resources and would throw an unexpected exception later in the test.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org