Skip to content

Commit

Permalink
Revert "[SPARK-35002][YARN][TESTS][FOLLOW-UP] Fix java.net.BindExcept…
Browse files Browse the repository at this point in the history
…ion in MiniYARNCluster"

This reverts commit 7c1177c.
  • Loading branch information
HyukjinKwon committed Apr 15, 2021
1 parent e24115c commit 0033804
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand All @@ -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.
Expand All @@ -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()

Expand All @@ -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
Expand Down Expand Up @@ -138,7 +117,7 @@ abstract class BaseYarnClusterSuite

override def afterAll(): Unit = {
try {
if (yarnCluster != null) yarnCluster.stop()
yarnCluster.stop()
} finally {
super.afterAll()
}
Expand Down

0 comments on commit 0033804

Please sign in to comment.