This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 408d4a327 [KYUUBI #6681][FOLLOWUP] Log the kill batch request before 
closeSession and during closeOperation
408d4a327 is described below

commit 408d4a32789e260b8e06d3f20759ec2f08ba5f44
Author: Wang, Fei <[email protected]>
AuthorDate: Mon Sep 23 17:49:45 2024 +0800

    [KYUUBI #6681][FOLLOWUP] Log the kill batch request before closeSession and 
during closeOperation
    
    # :mag: Description
    ## Issue References ๐Ÿ”—
    
    Followup for #6681
    
    We shall log the kill batch request before or inside `closeSession`, as it 
will close the operation log.
    ## Describe Your Solution ๐Ÿ”ง
    
    1. log the kill batch request before `closeSession`.
    2. log the kill batch response in BatchJobSubmission::close.
    
    ## Types of changes :bookmark:
    
    - [ ] Bugfix (non-breaking change which fixes an issue)
    - [ ] New feature (non-breaking change which adds functionality)
    - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
    
    ## Test Plan ๐Ÿงช
    
    #### Behavior Without This Pull Request :coffin:
    
    #### Behavior With This Pull Request :tada:
    
    #### Related Unit Tests
    
    <img width="1571" alt="image" 
src="https://github.com/user-attachments/assets/dbb4049a-6cf3-4ae5-a2a7-4decba67cd76";>
    
    ---
    
    # Checklist ๐Ÿ“
    
    - [x] This patch was not authored or co-authored using [Generative 
Tooling](https://www.apache.org/legal/generative-tooling.html)
    
    **Be nice. Be informative.**
    
    Closes #6697 from turboFei/kill_batch_log.
    
    Closes #6681
    
    13dbf4a75 [Wang, Fei] log
    617cf54a6 [Wang, Fei] log
    b3483c7e4 [Wang, Fei] log
    
    Authored-by: Wang, Fei <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala  | 5 ++++-
 .../main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala | 5 ++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala
index 939806d17..671d8ba65 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala
@@ -125,7 +125,10 @@ class BatchJobSubmission(
   }
 
   private[kyuubi] def killBatchApplication(): KillResponse = {
-    applicationManager.killApplication(builder.appMgrInfo(), batchId, 
Some(session.user))
+    val (killed, msg) =
+      applicationManager.killApplication(builder.appMgrInfo(), batchId, 
Some(session.user))
+    withOperationLog(warn(s"Kill batch response: killed: $killed, msg: $msg."))
+    (killed, msg)
   }
 
   private val applicationCheckInterval =
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala
index be0d3bdf6..d757a0d2b 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala
@@ -501,12 +501,11 @@ private[v1] class BatchesResource extends 
ApiRequestContext with Logging {
     sessionManager.getBatchSession(sessionHandle).map { batchSession =>
       val userName = fe.getSessionUser(batchSession.user)
       val ipAddress = fe.getIpAddress
-      sessionManager.closeSession(batchSession.handle)
-      val (killed, msg) = batchSession.batchJobSubmissionOp.getKillMessage
       batchSession.batchJobSubmissionOp.withOperationLog {
         warn(s"Received kill batch request from $userName/$ipAddress")
-        warn(s"Kill batch response: killed: $killed, msg: $msg.")
       }
+      sessionManager.closeSession(batchSession.handle)
+      val (killed, msg) = batchSession.batchJobSubmissionOp.getKillMessage
       new CloseBatchResponse(killed, msg)
     }.getOrElse {
       sessionManager.getBatchMetadata(batchId).map { metadata =>

Reply via email to