Skip to content

Commit

Permalink
[KYUUBI #5391] Close batch session after batch operation completion f…
Browse files Browse the repository at this point in the history
…or idle timeout

### _Why are the changes needed?_

To add a limitation for batch session lifecycle. otherwise, the batch session might always alive.
### _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 #5391 from turboFei/close_session_with_maxtimeout.

Closes #5391

5639c7d [fwang12] session no op

Authored-by: fwang12 <fwang12@ebay.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
  • Loading branch information
turboFei authored and pan3793 committed Oct 10, 2023
1 parent e33df9c commit e1d213e
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@ class KyuubiBatchSession(
override def createTime: Long = metadata.map(_.createTime).getOrElse(super.createTime)

override def getNoOperationTime: Long = {
if (batchJobSubmissionOp != null && !OperationState.isTerminal(
batchJobSubmissionOp.getStatus.state)) {
0L
if (batchJobSubmissionOp != null) {
val batchStatus = batchJobSubmissionOp.getStatus
if (!OperationState.isTerminal(batchStatus.state)) {
0L
} else {
System.currentTimeMillis() - batchStatus.completed
}
} else {
super.getNoOperationTime
}
Expand Down

0 comments on commit e1d213e

Please sign in to comment.