You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/06/06 14:57:11 UTC

incubator-kylin git commit: minor, DebugTomcat pick up job jar locations from dev dev

Repository: incubator-kylin
Updated Branches:
  refs/heads/0.8.0 ff8bfd6cf -> cdba06c45


minor, DebugTomcat pick up job jar locations from dev dev


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

Branch: refs/heads/0.8.0
Commit: cdba06c4534a2c2f53529bda059f2778c675a8c0
Parents: ff8bfd6
Author: Yang Li <li...@apache.org>
Authored: Sat Jun 6 20:57:05 2015 +0800
Committer: Yang Li <li...@apache.org>
Committed: Sat Jun 6 20:57:05 2015 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/common/KylinConfig.java    | 31 ++++++++++----------
 .../java/org/apache/kylin/rest/DebugTomcat.java | 25 ++++++++++++++++
 2 files changed, 41 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/cdba06c4/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 b049fd0..34e75a5 100644
--- a/common/src/main/java/org/apache/kylin/common/KylinConfig.java
+++ b/common/src/main/java/org/apache/kylin/common/KylinConfig.java
@@ -312,6 +312,7 @@ public class KylinConfig {
     }
 
     public void overrideKylinJobJarPath(String path) {
+        logger.info("override " + KYLIN_JOB_JAR + " to " + path);
         System.setProperty(KYLIN_JOB_JAR, path);
     }
 
@@ -349,6 +350,7 @@ public class KylinConfig {
     }
 
     public void overrideCoprocessorLocalJar(String path) {
+        logger.info("override " + COPROCESSOR_LOCAL_JAR + " to " + path);
         System.setProperty(COPROCESSOR_LOCAL_JAR, path);
     }
 
@@ -492,7 +494,6 @@ public class KylinConfig {
         return property != null ? property : kylinConfig.getString(prop);
     }
 
-
     private String[] getOptionalStringArray(String prop) {
         final String property = System.getProperty(prop);
         if (!StringUtils.isBlank(property))
@@ -585,8 +586,8 @@ public class KylinConfig {
             logger.error("fail to locate kylin.properties");
             throw new RuntimeException("fail to locate kylin.properties");
         }
-        
-        File overrideFile = new File (propFile.getParentFile(), propFile.getName() + ".override");
+
+        File overrideFile = new File(propFile.getParentFile(), propFile.getName() + ".override");
         if (overrideFile.exists()) {
             try {
                 PropertiesConfiguration conf = new PropertiesConfiguration();
@@ -601,7 +602,7 @@ public class KylinConfig {
                 throw new RuntimeException(e);
             }
         }
-        
+
         try {
             return new FileInputStream(propFile);
         } catch (FileNotFoundException e) {
@@ -706,17 +707,17 @@ public class KylinConfig {
     public int getHBaseRegionCut(String capacity) {
         String cut;
         switch (capacity) {
-            case "SMALL":
-                cut = getProperty(HBASE_REGION_CUT_SMALL, "5");
-                break;
-            case "MEDIUM":
-                cut = getProperty(HBASE_REGION_CUT_MEDIUM, "10");
-                break;
-            case "LARGE":
-                cut = getProperty(HBASE_REGION_CUT_LARGE, "50");
-                break;
-            default:
-                throw new IllegalArgumentException("Capacity not recognized: " + capacity);
+        case "SMALL":
+            cut = getProperty(HBASE_REGION_CUT_SMALL, "5");
+            break;
+        case "MEDIUM":
+            cut = getProperty(HBASE_REGION_CUT_MEDIUM, "10");
+            break;
+        case "LARGE":
+            cut = getProperty(HBASE_REGION_CUT_LARGE, "50");
+            break;
+        default:
+            throw new IllegalArgumentException("Capacity not recognized: " + capacity);
         }
 
         return Integer.valueOf(cut);

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/cdba06c4/server/src/main/java/org/apache/kylin/rest/DebugTomcat.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/kylin/rest/DebugTomcat.java b/server/src/main/java/org/apache/kylin/rest/DebugTomcat.java
index bbdde7a..75c2de7 100644
--- a/server/src/main/java/org/apache/kylin/rest/DebugTomcat.java
+++ b/server/src/main/java/org/apache/kylin/rest/DebugTomcat.java
@@ -38,6 +38,8 @@ public class DebugTomcat {
             // test_case_data/sandbox/ contains HDP 2.2 site xmls which is dev sandbox
             ClasspathUtil.addClasspath(new File("../examples/test_case_data/sandbox").getAbsolutePath());
             System.setProperty(KylinConfig.KYLIN_CONF, "../examples/test_case_data/sandbox");
+            overrideDevJobJarLocations();
+
             System.setProperty("spring.profiles.active", "testing");
             if (System.getProperty("hdp.version") == null)
                 System.setProperty("hdp.version", "2.2.4.2-2"); // mapred-site.xml ref this
@@ -66,6 +68,29 @@ public class DebugTomcat {
         }
     }
 
+    private static void overrideDevJobJarLocations() {
+        KylinConfig conf = KylinConfig.getInstanceFromEnv();
+        File devJobJar = findFile("../job/target", "kylin-job-.*-SNAPSHOT-job.jar");
+        if (devJobJar != null) {
+            conf.overrideKylinJobJarPath(devJobJar.getAbsolutePath());
+        }
+        File devCoprocessorJar = findFile("../storage/target", "kylin-storage-.*-SNAPSHOT-coprocessor.jar");
+        if (devCoprocessorJar != null) {
+            conf.overrideCoprocessorLocalJar(devCoprocessorJar.getAbsolutePath());
+        }
+    }
+
+    private static File findFile(String dir, String ptn) {
+        File[] files = new File(dir).listFiles();
+        if (files != null) {
+            for (File f : files) {
+                if (f.getName().matches(ptn))
+                    return f;
+            }
+        }
+        return null;
+    }
+
     public static void main(String[] args) throws Exception {
         setupDebugEnv();