You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/06/13 07:06:07 UTC
[GitHub] [incubator-kyuubi] yaooqinn commented on a diff in pull request #2827: [BUILD][TEST] Decouple integration tests from kyuubi-server
yaooqinn commented on code in PR #2827:
URL: https://github.com/apache/incubator-kyuubi/pull/2827#discussion_r895389244
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala:
##########
@@ -297,28 +297,36 @@ trait ProcBuilder {
* @return SPARK_HOME, HIVE_HOME, etc.
*/
protected def getEngineHome(shortName: String): String = {
+ val homeDirFilter: FilenameFilter = (dir: File, name: String) =>
+ dir.isDirectory && name.contains(s"$shortName-") && !name.contains("-engine")
+
val homeKey = s"${shortName.toUpperCase}_HOME"
- val homeVal = env.get(homeKey).orElse {
- val cwd = Utils.getCodeSourceLocation(getClass).split("kyuubi-server")
- assert(cwd.length > 1)
- Option(
- Paths.get(cwd.head)
- .resolve("externals")
- .resolve("kyuubi-download")
- .resolve("target")
- .toFile
- .listFiles(new FilenameFilter {
- override def accept(dir: File, name: String): Boolean = {
- dir.isDirectory && name.contains(s"$shortName-")
- }
- }))
- .flatMap(_.headOption)
- .map(_.getAbsolutePath)
- }
- if (homeVal.isEmpty) {
- throw validateEnv(homeKey)
- } else {
- homeVal.get
+ // 1. get from env, e.g. SPARK_HOME, FLINK_HOME
+ env.get(homeKey)
+ .orElse {
+ // 2. get from $KYUUBI_HOME/externals
+ env.get(KYUUBI_HOME).toSeq.flatMap { p =>
Review Comment:
`.map` with Option directly?
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org