You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by GitBox <gi...@apache.org> on 2021/12/03 06:00:36 UTC

[GitHub] [incubator-kyuubi] yanghua commented on a change in pull request #1445: [Kyuubi #1444 ] Implement api: /${version}/sessions/${session_identifier}/operations/${operation_identifier}

yanghua commented on a change in pull request #1445:
URL: https://github.com/apache/incubator-kyuubi/pull/1445#discussion_r761666847



##########
File path: kyuubi-common/src/main/scala/org/apache/kyuubi/session/AbstractSession.scala
##########
@@ -171,6 +171,10 @@ abstract class AbstractSession(
     runOperation(operation)
   }
 
+  override def isHasOperationHandle(operationHandle: OperationHandle): Boolean = {

Review comment:
       not necessary to add this API

##########
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

Review comment:
       @simon824 Actually, this API should return detailed information that comes from the `Operation` object. e.g.:
   
   - shouldRunAsync
   - isTimedOut
   - operation status
   - ...




-- 
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: commits-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org