pan3793 commented on code in PR #7616:
URL: https://github.com/apache/kyuubi/pull/7616#discussion_r4398353323
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilder.scala:
##########
@@ -60,7 +60,7 @@ class SparkProcessBuilder(
import SparkProcessBuilder._
- private[kyuubi] val sparkHome = getEngineHome(shortName)
+ private[kyuubi] lazy val sparkHome = getEngineHome(shortName)
Review Comment:
Please add a comment on why this must be lazy (read during `ProcBuilder`
init via `appMgrInfo()` -> `defaultsConf`), otherwise a later cleanup may turn
it back into a strict val.
##########
kyuubi-server/src/test/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilderSuite.scala:
##########
@@ -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)
Review Comment:
`env` is `sys.env ++ engineEnv`, so an exported `SPARK_CONF_DIR` on the host
takes precedence over `$sparkHome/conf` and breaks this test. Set
`kyuubi.engineEnv.SPARK_CONF_DIR` explicitly.
##########
kyuubi-server/src/test/scala/org/apache/kyuubi/engine/spark/SparkProcessBuilderSuite.scala:
##########
@@ -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"))
Review Comment:
Also assert that `KYUUBI_ENGINE_APP_MGR_INFO_KEY` in the builder conf
deserializes to `ApplicationManagerInfo(Some("yarn"), ...)`, which is the
user-visible symptom.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]