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 2022/07/01 01:32:42 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #2978] [SUB-TASK][KPIP-4] If batch app status not found from cluster manager, fall back to metadata store

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/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new b115c8dd2 [KYUUBI #2978] [SUB-TASK][KPIP-4] If batch app status not found from cluster manager, fall back to metadata store
b115c8dd2 is described below

commit b115c8dd24fc55bb4b1b7d559af4188a28d25199
Author: Fei Wang <fw...@ebay.com>
AuthorDate: Fri Jul 1 09:32:35 2022 +0800

    [KYUUBI #2978] [SUB-TASK][KPIP-4] If batch app status not found from cluster manager, fall back to metadata store
    
    ### _Why are the changes needed?_
    
    Because the kyuubi batch is not closed once the session completed(reserve the batch log for sometime).
    
    If a batch has been finished for some time, it might can not be found from RM, which has max reserved application list limitation, for this case, we need fall back to metadata for batch info response.
    
    Before:
    <img width="1085" alt="image" src="https://user-images.githubusercontent.com/6757692/176682626-294da2bd-eb37-4b6f-95e9-052990fa2a85.png">
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [x] Add screenshots for manual tests if appropriate
    
    - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #2978 from turboFei/fall_back_metadata.
    
    Closes #2978
    
    a0a51ac0 [Fei Wang] If batch app status not found, fall back to metadata
    
    Authored-by: Fei Wang <fw...@ebay.com>
    Signed-off-by: Fei Wang <fw...@ebay.com>
---
 .../kyuubi/server/api/v1/BatchesResource.scala      | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

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 1c223a49e..91ee66d18 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
@@ -71,10 +71,23 @@ private[v1] class BatchesResource extends ApiRequestContext with Logging {
     val batchAppStatus = batchOp.currentApplicationState.getOrElse(Map.empty)
 
     val name = Option(batchOp.batchName).getOrElse(batchAppStatus.get(APP_NAME_KEY).orNull)
-    val appId = batchAppStatus.get(APP_ID_KEY).orNull
-    val appUrl = batchAppStatus.get(APP_URL_KEY).orNull
-    val appState = batchAppStatus.get(APP_STATE_KEY).orNull
-    val appDiagnostic = batchAppStatus.get(APP_ERROR_KEY).orNull
+    var appId: String = null
+    var appUrl: String = null
+    var appState: String = null
+    var appDiagnostic: String = null
+
+    if (batchAppStatus.nonEmpty) {
+      appId = batchAppStatus.get(APP_ID_KEY).orNull
+      appUrl = batchAppStatus.get(APP_URL_KEY).orNull
+      appState = batchAppStatus.get(APP_STATE_KEY).orNull
+      appDiagnostic = batchAppStatus.get(APP_ERROR_KEY).orNull
+    } else {
+      val metadata = sessionManager.getBatchMetadata(batchOp.batchId)
+      appId = metadata.engineId
+      appUrl = metadata.engineUrl
+      appState = metadata.engineState
+      appDiagnostic = metadata.engineError.orNull
+    }
 
     new Batch(
       batchOp.batchId,