yaooqinn commented on a change in pull request #1445:
URL: https://github.com/apache/incubator-kyuubi/pull/1445#discussion_r756555834
##########
File path:
kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/SessionsResource.scala
##########
@@ -322,6 +322,70 @@ private[v1] class SessionsResource extends
ApiRequestContext {
}
}
+ @ApiResponse(
+ responseCode = "200",
+ content = Array(new Content(
+ mediaType = MediaType.APPLICATION_JSON)),
+ description = "Close an operation")
+ @DELETE
+ @Path("{sessionHandle}/operations/{operationHandle}")
+ def closeOperation(
+ @PathParam("sessionHandle") sessionHandleStr: String,
+ @PathParam("operationHandle") operationHandleStr: String):
OperationHandle = {
+ val sessionHandle = getSessionHandle(sessionHandleStr)
+ val operationHandle = getOperationHandle(operationHandleStr)
+ try {
+
backendService.sessionManager.getSession(sessionHandle).closeOperation(operationHandle)
+ operationHandle
+ } catch {
+ case NonFatal(_) =>
+ throw new NotFoundException(s"Error closing an operation")
+ }
+ }
+
+ @ApiResponse(
+ responseCode = "200",
+ content = Array(new Content(
+ mediaType = MediaType.APPLICATION_JSON)),
+ description =
+ "Get an operation handle with a given session identifier and operation
identifier")
+ @GET
+ @Path("{sessionHandle}/operations/{operationHandle}")
+ def getOperationHandle(
+ @PathParam("sessionHandle") sessionHandleStr: String,
+ @PathParam("operationHandle") operationHandleStr: String):
OperationHandle = {
+ val sessionHandle = getSessionHandle(sessionHandleStr)
+ val operationHandle = getOperationHandle(operationHandleStr)
+ val hasHandle = backendService.sessionManager.getSession(sessionHandle)
+ .isHasOperationHandle(operationHandle)
+ if (hasHandle) {
+ operationHandle
+ } else {
+ throw new NotFoundException(s"Error getting operationHandle")
+ }
+
+ }
+
+ def getOperationHandle(operationHandleStr: String): OperationHandle = {
Review comment:
parseOperationHandle
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]