Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -169,11 +169,6 @@ trait ProcBuilder {
@volatile private[kyuubi] var process: Process = _
@volatile private[kyuubi] var processLaunched: Boolean = false

// Set engine application manger info conf
conf.set(
KyuubiReservedKeys.KYUUBI_ENGINE_APP_MGR_INFO_KEY,
ApplicationManagerInfo.serialize(appMgrInfo()))

private[kyuubi] lazy val engineLog: File = ProcBuilder.synchronized {
val engineLogTimeout = conf.get(KyuubiConf.ENGINE_LOG_TIMEOUT)
val currentTime = System.currentTimeMillis()
Expand Down Expand Up @@ -213,6 +208,12 @@ trait ProcBuilder {
def validateConf(): Unit = {}

final def start: Process = synchronized {

// Set engine application manger info conf
conf.set(
KyuubiReservedKeys.KYUUBI_ENGINE_APP_MGR_INFO_KEY,
ApplicationManagerInfo.serialize(appMgrInfo()))

process = processBuilder.start()
processLaunched = true
val reader = Files.newBufferedReader(engineLog.toPath, StandardCharsets.UTF_8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.kyuubi.engine.spark

import java.io.File
import java.nio.charset.StandardCharsets
import java.nio.file.{Files, Path, Paths, StandardOpenOption}
import java.time.{Duration, LocalDate}
import java.time.format.DateTimeFormatter
Expand Down Expand Up @@ -422,6 +423,21 @@ class SparkProcessBuilderSuite extends KerberizedTestHelper with MockitoSugar {
}
}

test("load spark master from spark-defaults.conf after initialization") {
val sparkHome = Utils.createTempDir("spark-home-with-defaults")
val sparkConfDir = Files.createDirectory(sparkHome.resolve("conf"))
Files.write(
sparkConfDir.resolve("spark-defaults.conf"),
s"$MASTER_KEY yarn".getBytes(StandardCharsets.UTF_8))

val builderConf = KyuubiConf(false)
.set("kyuubi.engineEnv.SPARK_HOME", sparkHome.toString)
.set("kyuubi.engineEnv.SPARK_SCALA_VERSION", SCALA_COMPILE_VERSION)
val builder = new SparkProcessBuilder("kentyao", true, builderConf)

assert(builder.clusterManager() === Some("yarn"))
}

test("Fix NullPointerException when SPARK_HOME is invalid") {
val notFoundMsg = "Failed to extract Scala version"
val listFailMsg = "Failed to list jars"
Expand Down
Loading