Skip to content

Commit

Permalink
get refId by user, sharelevel and subdomain
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohehuhu committed Mar 15, 2024
1 parent f54efdb commit 673035a
Showing 1 changed file with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,23 +262,27 @@ private[v1] class AdminResource extends ApiRequestContext with Logging {
val engineSpace = calculateEngineSpace(engine)
var msg = s"Engine $engineSpace is deleted successfully."
if (forceKill) {
if (StringUtils.isBlank(refId)) {
throw new IllegalArgumentException(s"Invalid refId: $refId")
}

val applicationManagerInfo = ApplicationManagerInfo(
Option(resourceManager),
Option(kubernetesContext),
Option(kubernetesNamespace))
val refIds = listEngines(
engineType,
shareLevel,
subdomain,
kyuubiProxyUser,
hs2ProxyUser).map(_.getAttributes.get("refId"))

val killMessage = fe.be.sessionManager.asInstanceOf[KyuubiSessionManager]
.applicationManager.killApplication(applicationManagerInfo, refId)
if (!killMessage._1) {
msg = s"Engine $engineSpace failed to get deleted forcibly," +
s"cause ${killMessage._2}"
error(msg)
throw new NotFoundException(msg)
}
refIds.filter(StringUtils.isNotBlank(_)).foreach(refId => {
val applicationManagerInfo = ApplicationManagerInfo(
Option(resourceManager),
Option(kubernetesContext),
Option(kubernetesNamespace))
val killMessage = fe.be.sessionManager.asInstanceOf[KyuubiSessionManager]
.applicationManager.killApplication(applicationManagerInfo, refId)
if (!killMessage._1) {
msg = s"Engine $engineSpace failed to get deleted forcibly," +
s"cause ${killMessage._2}"
error(msg)
throw new NotFoundException(msg)
}
})
} else {
withDiscoveryClient(fe.getConf) { discoveryClient =>
val engineNodes = discoveryClient.getChildren(engineSpace)
Expand Down

0 comments on commit 673035a

Please sign in to comment.