turboFei commented on code in PR #7037: URL: https://github.com/apache/kyuubi/pull/7037#discussion_r2054981407
########## kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala: ########## @@ -561,6 +561,52 @@ private[v1] class BatchesResource extends ApiRequestContext with Logging { } } + @ApiResponse( + responseCode = "200", + content = Array(new Content( + mediaType = MediaType.APPLICATION_JSON, + schema = new Schema(implementation = classOf[ReassignBatchResponse]))), + description = "Reassign batches to a new instance") + @GET + @Path("{kyuubiInstance}/reassign") + def reassignBatchSessions( + @PathParam("kyuubiInstance") kyuubiInstance: String, + @QueryParam("size") @DefaultValue("2147483647") size: Int, + @QueryParam("force") + @DefaultValue("false") force: Boolean): ReassignBatchResponse = { + val batchIds = sessionManager.getBatchIdsToRecover(kyuubiInstance) + if (batchIds.isEmpty) { + throw new IllegalStateException(s"No PENDING or RUNNING Batch Session from $kyuubiInstance") + } + val url = fe.connectionUrl + if (kyuubiInstance == url) { + throw new IllegalStateException(s"KyuubiInstance is alive: $kyuubiInstance") + } + if (!force && checkInstanceNetwork(kyuubiInstance, batchIds.head)) { + throw new IllegalStateException(s"KyuubiInstance is alive: $kyuubiInstance," + + s"please use force option to bypass this check") Review Comment: we can check the network during `reassignBatchSessions`, for every batch ########## kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala: ########## @@ -561,6 +561,52 @@ private[v1] class BatchesResource extends ApiRequestContext with Logging { } } + @ApiResponse( + responseCode = "200", + content = Array(new Content( + mediaType = MediaType.APPLICATION_JSON, + schema = new Schema(implementation = classOf[ReassignBatchResponse]))), + description = "Reassign batches to a new instance") + @GET Review Comment: should be @POST ########## kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala: ########## @@ -561,6 +561,52 @@ private[v1] class BatchesResource extends ApiRequestContext with Logging { } } + @ApiResponse( + responseCode = "200", + content = Array(new Content( + mediaType = MediaType.APPLICATION_JSON, + schema = new Schema(implementation = classOf[ReassignBatchResponse]))), + description = "Reassign batches to a new instance") + @GET + @Path("{kyuubiInstance}/reassign") + def reassignBatchSessions( + @PathParam("kyuubiInstance") kyuubiInstance: String, + @QueryParam("size") @DefaultValue("2147483647") size: Int, + @QueryParam("force") + @DefaultValue("false") force: Boolean): ReassignBatchResponse = { Review Comment: seems need to define a request body -- 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: notifications-unsubscr...@kyuubi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org For additional commands, e-mail: notifications-h...@kyuubi.apache.org