kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lid...@apache.org
Subject kylin git commit: KYLIN-1953 Error handling for diagnosis
Date Thu, 11 Aug 2016 07:38:28 GMT
Repository: kylin
Updated Branches:
  refs/heads/master 8824c5175 -> 8ecb7d455


KYLIN-1953 Error handling for diagnosis


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/8ecb7d45
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/8ecb7d45
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/8ecb7d45

Branch: refs/heads/master
Commit: 8ecb7d455cc96a787b441da628a0c87301595aa9
Parents: 8824c51
Author: lidongsjtu <lidong@apache.org>
Authored: Thu Aug 11 10:28:33 2016 +0800
Committer: lidongsjtu <lidong@apache.org>
Committed: Thu Aug 11 15:38:05 2016 +0800

----------------------------------------------------------------------
 .../apache/kylin/rest/controller/DiagnosisController.java | 10 +++++-----
 .../org/apache/kylin/rest/service/DiagnosisService.java   |  8 ++++++--
 2 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/8ecb7d45/server-base/src/main/java/org/apache/kylin/rest/controller/DiagnosisController.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/controller/DiagnosisController.java
b/server-base/src/main/java/org/apache/kylin/rest/controller/DiagnosisController.java
index b9da9b2..826f888 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/controller/DiagnosisController.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/controller/DiagnosisController.java
@@ -47,7 +47,7 @@ import com.google.common.collect.Lists;
 
 @Controller
 @RequestMapping(value = "/diag")
-public class DiagnosisController {
+public class DiagnosisController extends BasicController {
 
     private static final Logger logger = LoggerFactory.getLogger(DiagnosisController.class);
 
@@ -66,7 +66,7 @@ public class DiagnosisController {
             BadQueryHistory badQueryHistory = dgService.getProjectBadQueryHistory(project);
             badEntry.addAll(badQueryHistory.getEntries());
         } catch (IOException e) {
-            throw new InternalErrorException(e + " Caused by: " + e.getMessage(), e);
+            throw new InternalErrorException("Failed to get bad queries.", e);
         }
 
         return badEntry;
@@ -82,7 +82,7 @@ public class DiagnosisController {
         try {
             filePath = dgService.dumpProjectDiagnosisInfo(project);
         } catch (IOException e) {
-            throw new InternalErrorException(e + " Caused by: " + e.getMessage(), e);
+            throw new InternalErrorException("Failed to dump diagnosis info.", e);
         }
 
         setDownloadResponse(filePath, response);
@@ -98,7 +98,7 @@ public class DiagnosisController {
         try {
             filePath = dgService.dumpJobDiagnosisInfo(jobId);
         } catch (IOException e) {
-            throw new InternalErrorException(e + " Caused by: " + e.getMessage(), e);
+            throw new InternalErrorException("Failed to dump diagnosis info.", e);
         }
 
         setDownloadResponse(filePath, response);
@@ -114,7 +114,7 @@ public class DiagnosisController {
             IOUtils.copyLarge(fileInputStream, output);
             output.flush();
         } catch (IOException e) {
-            throw new InternalErrorException(e + " Caused by: " + e.getMessage(), e);
+            throw new InternalErrorException("Failed to dump diagnosis info.", e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/8ecb7d45/server-base/src/main/java/org/apache/kylin/rest/service/DiagnosisService.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/service/DiagnosisService.java
b/server-base/src/main/java/org/apache/kylin/rest/service/DiagnosisService.java
index 9f2f261..dee5531 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/service/DiagnosisService.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/service/DiagnosisService.java
@@ -90,8 +90,12 @@ public class DiagnosisService extends BasicService {
 
         String diagCmd = script.getAbsolutePath() + " " + StringUtils.join(args, " ");
         CliCommandExecutor executor = KylinConfig.getInstanceFromEnv().getCliCommandExecutor();
-        Pair<Integer, String> cmdOutput = executor.execute(diagCmd);
-        logger.info(cmdOutput.getValue());
+        Pair<Integer, String> cmdOutput = executor.execute(diagCmd, new org.apache.kylin.common.util.Logger()
{
+            @Override
+            public void log(String message) {
+                logger.info(message);
+            }
+        });
 
         if (cmdOutput.getKey() != 0) {
             throw new RuntimeException("Failed to generate diagnosis package.");


Mime
View raw message