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 2023/02/28 08:54:42 UTC
[kyuubi] branch master updated: [KYUUBI #4424][REST] Catch No Node Exception, when list kyuubi engines
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/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 5b3ab9ca9 [KYUUBI #4424][REST] Catch No Node Exception, when list kyuubi engines
5b3ab9ca9 is described below
commit 5b3ab9ca924b789b4f10f91600ffed684265e958
Author: zwangsheng <22...@qq.com>
AuthorDate: Tue Feb 28 08:54:33 2023 +0000
[KYUUBI #4424][REST] Catch No Node Exception, when list kyuubi engines
### _Why are the changes needed?_
Close #4424
Catch No Node Exception, when list kyuubi engines
### _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
- [ ] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
![WX20230227-184957](https://user-images.githubusercontent.com/52876270/221544376-2f0d6b4b-0bc4-446e-abb1-d0c79211aea4.png)
Closes #4425 from zwangsheng/kyuubi-4424.
Closes #4424
3052b157 [zwangsheng] [Kyuubi #4424] Fix scala style
74825cf8 [zwangsheng] [Kyuubi #4424] Throw User Friendly Exception
7e8363cc [zwangsheng] [Kyuubi #4424] Remove usless file & catch subException
4a3c469a [zwangsheng] [Kyuubi #4424] Catch cacth No Node Exception, when list kyuubi engines
Authored-by: zwangsheng <22...@qq.com>
Signed-off-by: ulyssesyou <ul...@apache.org>
---
.../org/apache/kyuubi/server/api/v1/AdminResource.scala | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 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 a85cef16d..2aae7076c 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
@@ -27,6 +27,7 @@ import scala.collection.mutable.ListBuffer
import io.swagger.v3.oas.annotations.media.{ArraySchema, Content, Schema}
import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.swagger.v3.oas.annotations.tags.Tag
+import org.apache.zookeeper.KeeperException.NoNodeException
import org.apache.kyuubi.{KYUUBI_VERSION, Logging, Utils}
import org.apache.kyuubi.client.api.v1.dto.{Engine, SessionData}
@@ -207,9 +208,19 @@ private[v1] class AdminResource extends ApiRequestContext with Logging {
}
case None =>
withDiscoveryClient(fe.getConf) { discoveryClient =>
- discoveryClient.getChildren(engineSpace).map { child =>
- info(s"Listing engine nodes for $engineSpace/$child")
- engineNodes ++= discoveryClient.getServiceNodesInfo(s"$engineSpace/$child")
+ try {
+ discoveryClient.getChildren(engineSpace).map { child =>
+ info(s"Listing engine nodes for $engineSpace/$child")
+ engineNodes ++= discoveryClient.getServiceNodesInfo(s"$engineSpace/$child")
+ }
+ } catch {
+ case nne: NoNodeException =>
+ error(
+ s"No such engine for user: $userName, " +
+ s"engine type: $engineType, share level: $shareLevel, subdomain: $subdomain",
+ nne)
+ throw new NotFoundException(s"No such engine for user: $userName, " +
+ s"engine type: $engineType, share level: $shareLevel, subdomain: $subdomain")
}
}
}