You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2023/05/10 12:34:16 UTC
[kyuubi] branch master updated: [KYUUBI #4811] Do not update app info after batch or application terminated
This is an automated email from the ASF dual-hosted git repository.
feiwang 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 299df0d7c [KYUUBI #4811] Do not update app info after batch or application terminated
299df0d7c is described below
commit 299df0d7c2ad9ad6509861fada2d25ee2933e1fd
Author: fwang12 <fw...@ebay.com>
AuthorDate: Wed May 10 20:34:08 2023 +0800
[KYUUBI #4811] Do not update app info after batch or application terminated
### _Why are the changes needed?_
If the application has been terminated, it is not needed to update application. and It can prevent that, the correct application info is overwritten by NOT_FOUND state.
If the batch has been terminated, we shall get the batch report from metastore.
### _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/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #4811 from turboFei/k8s_status.
Closes #4811
8fc6fd6ab [fwang12] check app id defined
87b0797e0 [fwang12] if batch state is terminal, get state from metadata store
488433e05 [fwang12] save
Authored-by: fwang12 <fw...@ebay.com>
Signed-off-by: fwang12 <fw...@ebay.com>
---
.../org/apache/kyuubi/operation/BatchJobSubmission.scala | 13 ++++++++-----
.../org/apache/kyuubi/server/api/v1/BatchesResource.scala | 2 +-
2 files changed, 9 insertions(+), 6 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 e77416d31..96022614e 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
@@ -298,11 +298,14 @@ class BatchJobSubmission(
}
private def updateApplicationInfoMetadataIfNeeded(): Unit = {
- val newApplicationStatus = currentApplicationInfo()
- if (newApplicationStatus.map(_.state) != _applicationInfo.map(_.state)) {
- _applicationInfo = newApplicationStatus
- updateBatchMetadata()
- info(s"Batch report for $batchId, ${_applicationInfo}")
+ if (applicationId(_applicationInfo).isEmpty ||
+ !_applicationInfo.map(_.state).exists(ApplicationState.isTerminated)) {
+ val newApplicationStatus = currentApplicationInfo()
+ if (newApplicationStatus.map(_.state) != _applicationInfo.map(_.state)) {
+ _applicationInfo = newApplicationStatus
+ updateBatchMetadata()
+ info(s"Batch report for $batchId, ${_applicationInfo}")
+ }
}
}
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 38ce0e297..11c36c757 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
@@ -82,7 +82,7 @@ private[v1] class BatchesResource extends ApiRequestContext with Logging {
var appState: String = null
var appDiagnostic: String = null
- if (batchAppStatus.nonEmpty) {
+ if (!OperationState.isTerminal(batchOpStatus.state) && batchAppStatus.nonEmpty) {
appId = batchAppStatus.get.id
appUrl = batchAppStatus.get.url.orNull
appState = batchAppStatus.get.state.toString