You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2022/11/10 04:46:58 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #3786] Do not show the app Diagnostic for list batch command

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

chengpan 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 02fe75708 [KYUUBI #3786] Do not show the app Diagnostic for list batch command
02fe75708 is described below

commit 02fe75708dcae4bb15bb6c16000d8bcd8d35b523
Author: Tianlin Liao <ti...@ebay.com>
AuthorDate: Thu Nov 10 12:46:47 2022 +0800

    [KYUUBI #3786] Do not show the app Diagnostic for list batch command
    
    ### _Why are the changes needed?_
    
    Close #3786
    
    ### _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
    
    Before: (with diagnostic)
    <img width="1780" alt="image (5)" src="https://user-images.githubusercontent.com/21362040/200830694-74276fdf-8c92-4354-9b8d-525564dbdbd6.png">
    <img width="1792" alt="image" src="https://user-images.githubusercontent.com/21362040/200831721-36943c48-1e08-4711-8529-621afef638d4.png">
    
    After: (without diagnostic)
    ![image (4)](https://user-images.githubusercontent.com/21362040/200830746-4bc3b1c2-d106-4929-9005-0a5451e0b9fd.png)
    
    - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #3789 from lightning-L/kyuubi-3786.
    
    Closes #3786
    
    4f5af8b1 [Tianlin Liao] [KYUUBI #3786] Do not show the app Diagnostic for list batch command
    
    Authored-by: Tianlin Liao <ti...@ebay.com>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../main/scala/org/apache/kyuubi/ctl/util/Render.scala    | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/Render.scala b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/Render.scala
index 23f7d4840..b0beb1b16 100644
--- a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/Render.scala
+++ b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/Render.scala
@@ -70,7 +70,8 @@ private[ctl] object Render {
 
   def renderBatchListInfo(batchListInfo: GetBatchesResponse): String = {
     val title = s"Batch List (from ${batchListInfo.getFrom} total ${batchListInfo.getTotal})"
-    val rows = batchListInfo.getBatches.asScala.sortBy(_.getCreateTime).map(buildBatchRow).toArray
+    val rows = batchListInfo.getBatches.asScala.sortBy(_.getCreateTime)
+      .map(batch => buildBatchRow(batch, false)).toArray
     Tabulator.format(title, batchColumnNames, rows)
   }
 
@@ -94,21 +95,21 @@ private[ctl] object Render {
       "Kyuubi Instance",
       "Time Range")
 
-  private def buildBatchRow(batch: Batch): Array[String] = {
+  private def buildBatchRow(batch: Batch, showDiagnostic: Boolean = true): Array[String] = {
     Array(
       batch.getId,
       batch.getBatchType,
       batch.getName,
       batch.getUser,
       batch.getState,
-      buildBatchAppInfo(batch).mkString("\n"),
+      buildBatchAppInfo(batch, showDiagnostic).mkString("\n"),
       batch.getKyuubiInstance,
       Seq(
         millisToDateString(batch.getCreateTime, "yyyy-MM-dd HH:mm:ss"),
         millisToDateString(batch.getEndTime, "yyyy-MM-dd HH:mm:ss")).mkString("\n~\n"))
   }
 
-  private def buildBatchAppInfo(batch: Batch): List[String] = {
+  private def buildBatchAppInfo(batch: Batch, showDiagnostic: Boolean = true): List[String] = {
     val batchAppInfo = ListBuffer[String]()
     Option(batch.getAppId).foreach { _ =>
       batchAppInfo += s"App Id: ${batch.getAppId}"
@@ -119,8 +120,10 @@ private[ctl] object Render {
     Option(batch.getAppState).foreach { _ =>
       batchAppInfo += s"App State: ${batch.getAppState}"
     }
-    Option(batch.getAppDiagnostic).filter(_.nonEmpty).foreach { _ =>
-      batchAppInfo += s"App Diagnostic: ${batch.getAppDiagnostic}"
+    if (showDiagnostic) {
+      Option(batch.getAppDiagnostic).filter(_.nonEmpty).foreach { _ =>
+        batchAppInfo += s"App Diagnostic: ${batch.getAppDiagnostic}"
+      }
     }
     batchAppInfo.toList
   }