Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KYUUBI #4424][REST] Catch No Node Exception, when list kyuubi engines #6

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import scala.collection.mutable.ListBuffer
import io.swagger.v3.oas.annotations.media.Content
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
Expand Down Expand Up @@ -140,9 +141,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")
}
}
}
Expand Down