This is an automated email from the ASF dual-hosted git repository.
chengpan pushed a commit to branch branch-1.8
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/branch-1.8 by this push:
new e2f769385 [KYUUBI #5725] Handle the session exception for all kyuubi
operations during running
e2f769385 is described below
commit e2f7693858a4f6b375c898941e15ef0ead6917d4
Author: fwang12 <[email protected]>
AuthorDate: Mon Nov 20 14:09:18 2023 +0800
[KYUUBI #5725] Handle the session exception for all kyuubi operations
during running
# :mag: Description
Now only the `LaunchEngine` and `BatchJobSubmission` handle the kyuubi
session exception.
We shall handle the session exception for all kyuubi operations, so that
the user can get the correct KyuubiSessionEvent with RESTful API.
## Issue References ๐
This pull request fixes #
## Describe Your Solution ๐ง
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that are
required for this change.
## Types of changes :bookmark:
- [x] 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
---
# Checklists
## ๐ Author Self Checklist
- [x] My code follows the [style
guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html)
of this project
- [ ] I have performed a self-review
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature
works
- [ ] New and existing unit tests pass locally with my changes
- [x] This patch was not authored or co-authored using [Generative
Tooling](https://www.apache.org/legal/generative-tooling.html)
## ๐ Committer Pre-Merge Checklist
- [x] Pull request title is okay.
- [ ] No license issues.
- [ ] Milestone correctly set?
- [ ] Test coverage is ok
- [ ] Assignees are selected.
- [ ] Minimum number of approvals
- [ ] No changes are requested
**Be nice. Be informative.**
Closes #5725 from turboFei/handle_session_exception_rest.
Closes #5725
dd514f3ef [fwang12] remove
161495198 [fwang12] handle
cee917158 [fwang12] Revert "handle session exception for all kyuubi
operations"
4a0c19216 [fwang12] Revert "comment"
7ce89f893 [fwang12] comment
5d9d4dc42 [fwang12] handle session exception for all kyuubi operations
Authored-by: fwang12 <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
(cherry picked from commit 39f39a11ab10d6627deb0bec5fd83e0ed99fb22e)
Signed-off-by: Cheng Pan <[email protected]>
---
.../org/apache/kyuubi/operation/BatchJobSubmission.scala | 2 +-
.../org/apache/kyuubi/operation/ExecutedCommandExec.scala | 2 +-
.../scala/org/apache/kyuubi/operation/KyuubiOperation.scala | 13 ++++++++++++-
.../scala/org/apache/kyuubi/operation/LaunchEngine.scala | 2 +-
4 files changed, 15 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 af6242ae1..f48cd0fcf 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
@@ -182,7 +182,7 @@ class BatchJobSubmission(
OperationLog.removeCurrentOperationLog()
}
- override protected def runInternal(): Unit = session.handleSessionException {
+ override protected def runInternal(): Unit = {
val asyncOperation: Runnable = () => {
try {
metadata match {
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/ExecutedCommandExec.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/ExecutedCommandExec.scala
index 70b727e5e..2d38220e7 100644
---
a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/ExecutedCommandExec.scala
+++
b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/ExecutedCommandExec.scala
@@ -49,7 +49,7 @@ class ExecutedCommandExec(
OperationLog.removeCurrentOperationLog()
}
- override protected def runInternal(): Unit = session.handleSessionException {
+ override protected def runInternal(): Unit = {
val asyncOperation: Runnable = () => {
setState(OperationState.RUNNING)
try {
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/KyuubiOperation.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/KyuubiOperation.scala
index 83e19cb65..12002804c 100644
---
a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/KyuubiOperation.scala
+++
b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/KyuubiOperation.scala
@@ -32,7 +32,7 @@ import
org.apache.kyuubi.metrics.MetricsConstants.{OPERATION_FAIL, OPERATION_OPE
import org.apache.kyuubi.metrics.MetricsSystem
import org.apache.kyuubi.operation.FetchOrientation.FetchOrientation
import org.apache.kyuubi.operation.OperationState.OperationState
-import org.apache.kyuubi.session.{KyuubiSessionImpl, KyuubiSessionManager,
Session}
+import org.apache.kyuubi.session.{KyuubiSession, KyuubiSessionImpl,
KyuubiSessionManager, Session}
import org.apache.kyuubi.util.ThriftUtils
abstract class KyuubiOperation(session: Session) extends
AbstractOperation(session) {
@@ -100,6 +100,17 @@ abstract class KyuubiOperation(session: Session) extends
AbstractOperation(sessi
}
}
+ override def run(): Unit = {
+ beforeRun()
+ try {
+ session.asInstanceOf[KyuubiSession].handleSessionException {
+ runInternal()
+ }
+ } finally {
+ afterRun()
+ }
+ }
+
override protected def beforeRun(): Unit = {
setHasResultSet(true)
setState(OperationState.RUNNING)
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/LaunchEngine.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/LaunchEngine.scala
index 758dccb9d..cfbd2a0ca 100644
---
a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/LaunchEngine.scala
+++
b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/LaunchEngine.scala
@@ -53,7 +53,7 @@ class LaunchEngine(session: KyuubiSessionImpl, override val
shouldRunAsync: Bool
OperationLog.removeCurrentOperationLog()
}
- override protected def runInternal(): Unit = session.handleSessionException {
+ override protected def runInternal(): Unit = {
val asyncOperation: Runnable = () => {
setState(OperationState.RUNNING)
try {