kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [18/41] incubator-kylin git commit: Fix JobEngineConfig
Date Fri, 27 Feb 2015 06:25:31 GMT
Fix JobEngineConfig

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

Branch: refs/heads/inverted-index
Commit: 875c634ee00562d7f83ea6ca01f4e97ce42a6dba
Parents: ba4f737
Author: Shao Feng, Shi <shaoshi@ebay.com>
Authored: Fri Feb 13 10:51:27 2015 +0800
Committer: Shao Feng, Shi <shaoshi@ebay.com>
Committed: Fri Feb 13 10:51:27 2015 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/common/KylinConfig.java    | 11 +++++----
 .../kylin/job/engine/JobEngineConfig.java       | 24 ++++++++------------
 2 files changed, 15 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/875c634e/common/src/main/java/org/apache/kylin/common/KylinConfig.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/kylin/common/KylinConfig.java b/common/src/main/java/org/apache/kylin/common/KylinConfig.java
index 5138c0b..7a69e35 100644
--- a/common/src/main/java/org/apache/kylin/common/KylinConfig.java
+++ b/common/src/main/java/org/apache/kylin/common/KylinConfig.java
@@ -515,7 +515,7 @@ public class KylinConfig {
     public static String getKylinHome() {
         String kylinHome = System.getenv(KYLIN_HOME);
         if (StringUtils.isEmpty(kylinHome)) {
-            logger.warn("KYLIN_HOME has not been set");
+            logger.warn("KYLIN_HOME was not set");
             return kylinHome;
         }
         return kylinHome;
@@ -531,15 +531,16 @@ public class KylinConfig {
 
     private static File getKylinProperties() {
         String kylinConfHome = System.getProperty(KYLIN_CONF_HOME);
-        if (StringUtils.isEmpty(kylinConfHome)) {
-            logger.warn("KYLIN_CONF_HOME has not been set");
-        } else {
+        if (!StringUtils.isEmpty(kylinConfHome)) {
+            logger.info("Use KYLIN_CONF_HOME=" + kylinConfHome);
             return getKylinPropertiesFile(kylinConfHome);
         }
 
+        logger.warn("KYLIN_CONF_HOME property was not set, will seek KYLIN_HOME env variable");
+
         String kylinHome = getKylinHome();
         if (StringUtils.isEmpty(kylinHome))
-            throw new RuntimeException("getKylinProperties needs KYLIN_HOME");
+            throw new RuntimeException("Didn't find KYLIN_CONF_HOME or KYLIN_HOME, please
set one of them");
 
         String path = kylinHome + File.separator + "conf";
         return getKylinPropertiesFile(path);

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/875c634e/job/src/main/java/org/apache/kylin/job/engine/JobEngineConfig.java
----------------------------------------------------------------------
diff --git a/job/src/main/java/org/apache/kylin/job/engine/JobEngineConfig.java b/job/src/main/java/org/apache/kylin/job/engine/JobEngineConfig.java
index 3c01e09..08a5a2e 100644
--- a/job/src/main/java/org/apache/kylin/job/engine/JobEngineConfig.java
+++ b/job/src/main/java/org/apache/kylin/job/engine/JobEngineConfig.java
@@ -18,19 +18,14 @@
 
 package org.apache.kylin.job.engine;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
 import org.apache.commons.lang.StringUtils;
+import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.job.tools.OptionsHelper;
+import org.apache.kylin.metadata.model.DataModelDesc.RealizationCapacity;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.kylin.common.KylinConfig;
-import org.apache.kylin.metadata.model.DataModelDesc.RealizationCapacity;
+import java.io.*;
 
 /**
  * @author ysong1
@@ -62,14 +57,13 @@ public class JobEngineConfig {
 
         File jobConfig = getJobConfig(hadoopJobConfFile);
         if (jobConfig == null || !jobConfig.exists()) {
-            logger.warn("fail to locate " + hadoopJobConfFile);
-        }
-        jobConfig = getJobConfig(HADOOP_JOB_CONF_FILENAME + ".xml");
-        if (jobConfig == null || !jobConfig.exists()) {
-            logger.error("fail to locate " + HADOOP_JOB_CONF_FILENAME + ".xml");
-            throw new RuntimeException("fail to locate " + hadoopJobConfFile);
+            logger.warn("fail to locate " + hadoopJobConfFile + ", trying to locate " + HADOOP_JOB_CONF_FILENAME
+ ".xml");
+            jobConfig = getJobConfig(HADOOP_JOB_CONF_FILENAME + ".xml");
+            if (jobConfig == null || !jobConfig.exists()) {
+                logger.error("fail to locate " + HADOOP_JOB_CONF_FILENAME + ".xml");
+                throw new RuntimeException("fail to locate " + HADOOP_JOB_CONF_FILENAME +
".xml");
+            }
         }
-
         return OptionsHelper.convertToFileURL(jobConfig.getAbsolutePath());
     }
 


Mime
View raw message