Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,14 @@ abstract class HiveThriftServer2Test extends FunSuite with BeforeAndAfterAll wit

logInfo(s"Trying to start HiveThriftServer2: port=$port, mode=$mode, attempt=$attempt")

logPath = Process(command, None, "SPARK_TESTING" -> "0").lines.collectFirst {
val env = Seq(
// Disables SPARK_TESTING to exclude log4j.properties in test directories.
"SPARK_TESTING" -> "0",
// Points SPARK_PID_DIR to SPARK_HOME, otherwise only 1 Thrift server instance can be started
// at a time, which is not Jenkins friendly.
"SPARK_PID_DIR" -> "../../")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering a better path would be Utils.createTempDir(..), just in case we want to run the test suite simultaneously in the local machine as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, can we just use sys.props(java.io.tmpdir) instead of creating a new directory?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a different directory for each run, otherwise the PID file will be overwritten when multiple jenkins unit tests run parallel.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh you're right. Looks like we currently set it to /tmp already, which is probably what java.io.tmpdir is anyway in most cases


logPath = Process(command, None, env: _*).lines.collectFirst {
case line if line.contains(LOG_FILE_MARK) => new File(line.drop(LOG_FILE_MARK.length))
}.getOrElse {
throw new RuntimeException("Failed to find HiveThriftServer2 log file.")
Expand Down Expand Up @@ -346,7 +353,7 @@ abstract class HiveThriftServer2Test extends FunSuite with BeforeAndAfterAll wit

private def stopThriftServer(): Unit = {
// The `spark-daemon.sh' script uses kill, which is not synchronous, have to wait for a while.
Process(stopScript, None).run().exitValue()
Process(stopScript, None, "SPARK_PID_DIR" -> "../../").run().exitValue()
Thread.sleep(3.seconds.toMillis)

warehousePath.delete()
Expand Down