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

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


The following commit(s) were added to refs/heads/branch-1.7 by this push:
     new b0bb31bdd [KYUUBI #5232] In SparkOperation#cleanup always calls 
cancelJobGroup even though it's in the completed state
b0bb31bdd is described below

commit b0bb31bdd6569009395e4fb29c8083f0eed45bd3
Author: bkhan <[email protected]>
AuthorDate: Mon Sep 4 21:54:37 2023 +0800

    [KYUUBI #5232] In SparkOperation#cleanup always calls cancelJobGroup even 
though it's in the completed state
    
    ### _Why are the changes needed?_
    
    Implement this issue: #5232
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run 
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    ### _Was this patch authored or co-authored using generative AI tooling?_
    
    No
    
    Closes #5240 from XorSum/always_cancel_job_group.
    
    Closes #5232
    
    7da16aaa7 [bkhan] In SparkOperation#cleanup always calls cancelJobGroup 
even though it's in the completed state
    
    Authored-by: bkhan <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit 708a0bec6361811aefb4ad6c9d7815f9daebd591)
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../scala/org/apache/kyuubi/engine/spark/operation/SparkOperation.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/SparkOperation.scala
 
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/SparkOperation.scala
index 5062a4904..15cb3feb2 100644
--- 
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/SparkOperation.scala
+++ 
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/SparkOperation.scala
@@ -106,8 +106,8 @@ abstract class SparkOperation(session: Session)
     if (!isTerminalState(state)) {
       setState(targetState)
       Option(getBackgroundHandle).foreach(_.cancel(true))
-      if (!spark.sparkContext.isStopped) 
spark.sparkContext.cancelJobGroup(statementId)
     }
+    if (!spark.sparkContext.isStopped) 
spark.sparkContext.cancelJobGroup(statementId)
   }
 
   protected val forceCancel =

Reply via email to