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

feiwang pushed a commit to branch branch-1.8
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.8 by this push:
     new b6bef1239 [KYUUBI #4994][FOLLOWUP] Respect the engine type and share 
level for listing all engines
b6bef1239 is described below

commit b6bef1239fd37d3d2bb19a31978c88f40ca0ab3b
Author: fwang12 <[email protected]>
AuthorDate: Mon Oct 9 14:35:47 2023 +0800

    [KYUUBI #4994][FOLLOWUP] Respect the engine type and share level for 
listing all engines
    
    ### _Why are the changes needed?_
    
    Now, the specified engine type and share level does not work
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run 
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    ### _Was this patch authored or co-authored using generative AI tooling?_
    
    No
    
    Closes #5353 from turboFei/list_all_engines.
    
    Closes #4994
    
    49ad1acdb [fwang12] refactor
    295665bb1 [fwang12] respect the engine share level and type
    
    Authored-by: fwang12 <[email protected]>
    Signed-off-by: fwang12 <[email protected]>
    (cherry picked from commit 7eac40048807655306fface8dfef9c8795ea595d)
    Signed-off-by: fwang12 <[email protected]>
---
 .../org/apache/kyuubi/server/api/v1/AdminResource.scala   | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/AdminResource.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/AdminResource.scala
index 5f410ab7d..3c6f2a197 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/AdminResource.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/AdminResource.scala
@@ -298,15 +298,15 @@ private[v1] class AdminResource extends ApiRequestContext 
with Logging {
       }
       val engines = ListBuffer[Engine]()
       val engineSpace = fe.getConf.get(HA_NAMESPACE)
-      val shareLevel = fe.getConf.get(ENGINE_SHARE_LEVEL)
-      val engineType = fe.getConf.get(ENGINE_TYPE)
+      val finalShareLevel = 
Option(shareLevel).getOrElse(fe.getConf.get(ENGINE_SHARE_LEVEL))
+      val finalEngineType = 
Option(engineType).getOrElse(fe.getConf.get(ENGINE_TYPE))
       withDiscoveryClient(fe.getConf) { discoveryClient =>
-        val commonParent = 
s"/${engineSpace}_${KYUUBI_VERSION}_${shareLevel}_$engineType"
+        val commonParent = 
s"/${engineSpace}_${KYUUBI_VERSION}_${finalShareLevel}_$finalEngineType"
         info(s"Listing engine nodes for $commonParent")
         try {
           discoveryClient.getChildren(commonParent).map {
             user =>
-              val engine = getEngine(user, engineType, shareLevel, "", "")
+              val engine = getEngine(user, finalEngineType, finalShareLevel, 
"", "")
               val engineSpace = getEngineSpace(engine)
               discoveryClient.getChildren(engineSpace).map { child =>
                 info(s"Listing engine nodes for $engineSpace/$child")
@@ -324,9 +324,12 @@ private[v1] class AdminResource extends ApiRequestContext 
with Logging {
           }
         } catch {
           case nne: NoNodeException =>
-            error(s"No such engine for engine type: $engineType, share level: 
$shareLevel", nne)
+            error(
+              s"No such engine for engine type: $finalEngineType," +
+                s" share level: $finalShareLevel",
+              nne)
             throw new NotFoundException(
-              s"No such engine for engine type: $engineType, share level: 
$shareLevel")
+              s"No such engine for engine type: $finalEngineType, share level: 
$finalShareLevel")
         }
       }
       return engines.toSeq

Reply via email to