You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ul...@apache.org on 2022/04/14 01:51:58 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #2328] Support getting mainResource in the module target directory of KYUUBI_HOME

This is an automated email from the ASF dual-hosted git repository.

ulyssesyou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 8ef211a1d [KYUUBI #2328] Support getting mainResource in the module target directory of KYUUBI_HOME
8ef211a1d is described below

commit 8ef211a1d9df16b0e48928947ad58a420030c373
Author: wforget <64...@qq.com>
AuthorDate: Thu Apr 14 09:51:50 2022 +0800

    [KYUUBI #2328] Support getting mainResource in the module target directory of KYUUBI_HOME
    
    ### _Why are the changes needed?_
    
    close #2328
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [X] Add screenshots for manual tests if appropriate
    ![image](https://user-images.githubusercontent.com/17894939/163170409-cdae3e03-3b24-42c0-86c2-7e7eebb77af7.png)
    ![image](https://user-images.githubusercontent.com/17894939/163165337-1b11d533-e965-40c8-b724-3e835b46b5cc.png)
    
    - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #2350 from wForget/KYUUBI-2328.
    
    Closes #2328
    
    8e4f5d1a [wforget] [KYUUBI-2328] Support getting mainResource in the module target directory of KYUUBI_HOME
    
    Authored-by: wforget <64...@qq.com>
    Signed-off-by: ulysses-you <ul...@apache.org>
---
 .../src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala  | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
index 2919dbb91..39c58b04d 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
@@ -72,9 +72,13 @@ trait ProcBuilder {
       }
     }.orElse {
       // 2. get the main resource jar from system build default
-      env.get(KYUUBI_HOME)
-        .map { Paths.get(_, "externals", "engines", shortName, jarName) }
-        .filter(Files.exists(_)).map(_.toAbsolutePath.toFile.getCanonicalPath)
+      env.get(KYUUBI_HOME).toSeq
+        .flatMap { p =>
+          Seq(
+            Paths.get(p, "externals", "engines", shortName, jarName),
+            Paths.get(p, "externals", module, "target", jarName))
+        }
+        .find(Files.exists(_)).map(_.toAbsolutePath.toFile.getCanonicalPath)
     }.orElse {
       // 3. get the main resource from dev environment
       val cwd = Utils.getCodeSourceLocation(getClass).split("kyuubi-server")