You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2021/04/16 00:03:07 UTC

[spark] 01/02: Revert "[SPARK-35002][YARN][TESTS][FOLLOW-UP] Fix java.net.BindException in MiniYARNCluster"

This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git

commit 0033804a650d8cc7b54e3e78a148e17efb977f4f
Author: HyukjinKwon <gu...@apache.org>
AuthorDate: Fri Apr 16 08:58:45 2021 +0900

    Revert "[SPARK-35002][YARN][TESTS][FOLLOW-UP] Fix java.net.BindException in MiniYARNCluster"
    
    This reverts commit 7c1177c1d6e104106bdf5c4f26b866a579f0a2c2.
---
 .../java/org/apache/spark/network/TestUtils.java   |  4 +--
 .../spark/deploy/yarn/BaseYarnClusterSuite.scala   | 29 +++-------------------
 2 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/common/network-common/src/test/java/org/apache/spark/network/TestUtils.java b/common/network-common/src/test/java/org/apache/spark/network/TestUtils.java
index c2c5ffa..56a2b80 100644
--- a/common/network-common/src/test/java/org/apache/spark/network/TestUtils.java
+++ b/common/network-common/src/test/java/org/apache/spark/network/TestUtils.java
@@ -22,9 +22,7 @@ import java.net.InetAddress;
 public class TestUtils {
   public static String getLocalHost() {
     try {
-      return (System.getenv().containsKey("SPARK_LOCAL_IP"))?
-        System.getenv("SPARK_LOCAL_IP"):
-          InetAddress.getLocalHost().getHostAddress();
+      return InetAddress.getLocalHost().getHostAddress();
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
diff --git a/resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/BaseYarnClusterSuite.scala b/resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/BaseYarnClusterSuite.scala
index 460986a..f8ef0d0 100644
--- a/resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/BaseYarnClusterSuite.scala
+++ b/resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/BaseYarnClusterSuite.scala
@@ -28,12 +28,7 @@ import scala.concurrent.duration._
 import com.google.common.io.Files
 import org.apache.hadoop.yarn.conf.YarnConfiguration
 import org.apache.hadoop.yarn.server.MiniYARNCluster
-<<<<<<< HEAD
 import org.scalatest.{BeforeAndAfterAll, Matchers}
-=======
-import org.scalactic.source.Position
-import org.scalatest.{BeforeAndAfterAll, Tag}
->>>>>>> a153efa643d ([SPARK-35002][YARN][TESTS][FOLLOW-UP] Fix java.net.BindException in MiniYARNCluster)
 import org.scalatest.concurrent.Eventually._
 
 import org.apache.spark._
@@ -45,7 +40,6 @@ import org.apache.spark.util.Utils
 
 abstract class BaseYarnClusterSuite
   extends SparkFunSuite with BeforeAndAfterAll with Matchers with Logging {
-  private var isBindSuccessful = true
 
   // log4j configuration for the YARN containers, so that their output is collected
   // by YARN instead of trying to overwrite unit-tests.log.
@@ -69,14 +63,6 @@ abstract class BaseYarnClusterSuite
 
   def newYarnConfig(): YarnConfiguration
 
-  override protected def test(testName: String, testTags: Tag*)(testFun: => Any)
-                             (implicit pos: Position): Unit = {
-    super.test(testName, testTags: _*) {
-      assume(isBindSuccessful, "Mini Yarn cluster should be able to bind.")
-      testFun
-    }
-  }
-
   override def beforeAll(): Unit = {
     super.beforeAll()
 
@@ -93,16 +79,9 @@ abstract class BaseYarnClusterSuite
     yarnConf.set("yarn.nodemanager.disk-health-checker.max-disk-utilization-per-disk-percentage",
       "100.0")
 
-    try {
-      yarnCluster = new MiniYARNCluster(getClass().getName(), 1, 1, 1)
-      yarnCluster.init(yarnConf)
-      yarnCluster.start()
-    } catch {
-      case e: Throwable if org.apache.commons.lang3.exception.ExceptionUtils.indexOfThrowable(
-          e, classOf[java.net.BindException]) != -1 =>
-        isBindSuccessful = false
-        return
-    }
+    yarnCluster = new MiniYARNCluster(getClass().getName(), 1, 1, 1)
+    yarnCluster.init(yarnConf)
+    yarnCluster.start()
 
     // There's a race in MiniYARNCluster in which start() may return before the RM has updated
     // its address in the configuration. You can see this in the logs by noticing that when
@@ -138,7 +117,7 @@ abstract class BaseYarnClusterSuite
 
   override def afterAll(): Unit = {
     try {
-      if (yarnCluster != null) yarnCluster.stop()
+      yarnCluster.stop()
     } finally {
       super.afterAll()
     }

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