Github user tgravescs commented on a diff in the pull request:
https://github.com/apache/spark/pull/16667#discussion_r97330460
--- Diff:
resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/LocalityPlacementStrategySuite.scala
---
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.deploy.yarn
+
+import scala.collection.mutable.{HashMap, HashSet, Set}
+
+import org.apache.hadoop.fs.CommonConfigurationKeysPublic
+import org.apache.hadoop.net.DNSToSwitchMapping
+import org.apache.hadoop.yarn.api.records._
+import org.apache.hadoop.yarn.client.api.AMRMClient.ContainerRequest
+import org.apache.hadoop.yarn.conf.YarnConfiguration
+import org.mockito.Mockito._
+
+import org.apache.spark.{SparkConf, SparkFunSuite}
+
+class LocalityPlacementStrategySuite extends SparkFunSuite {
+
+ test("handle large number of containers and tasks (SPARK-18750)") {
+ // Run the test in a thread with a small stack size, since the
original issue
+ // surfaced as a StackOverflowError.
+ var error: Throwable = null
+
+ val runnable = new Runnable() {
+ override def run(): Unit = try {
+ runTest()
+ } catch {
+ case e: Throwable => error = e
+ }
+ }
+
+ val thread = new Thread(new ThreadGroup("test"), runnable,
"test-thread", 32 * 1024)
+ thread.start()
+ thread.join()
+
+ assert(error === null)
+ }
+
+ private def runTest(): Unit = {
+ val yarnConf = new YarnConfiguration()
+ yarnConf.setClass(
+
CommonConfigurationKeysPublic.NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
+ classOf[MockResolver], classOf[DNSToSwitchMapping])
+
+ val resource = Resource.newInstance(8 * 1024, 4)
+ val strategy = new LocalityPreferredContainerPlacementStrategy(new
SparkConf(),
+ yarnConf, resource)
+
+ val totalTasks = 32 * 1024
+ val totalContainers = totalTasks / 16
--- End diff --
any particular reason for the 16 here? I assume its just random selected
that shows the issue but perhaps add in a comment.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]