You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by av...@apache.org on 2017/10/18 17:16:35 UTC

ambari git commit: AMBARI-22192. Setup an application server for hosting the AD System Manager. (avijayan)

Repository: ambari
Updated Branches:
  refs/heads/branch-3.0-ams 67524d399 -> b0164a147


AMBARI-22192. Setup an application server for hosting the AD System Manager. (avijayan)


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

Branch: refs/heads/branch-3.0-ams
Commit: b0164a147b97e43dd2e8f74ebccadcaa372c3d72
Parents: 67524d3
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Wed Oct 18 10:16:28 2017 -0700
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Wed Oct 18 10:16:28 2017 -0700

----------------------------------------------------------------------
 .../pom.xml                                     | 52 +++++++++++++++++++-
 .../prototype/core/AmbariServerInterface.java   | 34 ++++++-------
 .../adservice/app/AnomalyDetectionApp.scala     |  2 +
 .../timeline/AbstractMiniHBaseClusterTest.java  | 13 +++++
 .../timeline/PhoenixHBaseAccessorTest.java      | 13 ++++-
 5 files changed, 94 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b0164a14/ambari-metrics/ambari-metrics-anomaly-detection-service/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/pom.xml b/ambari-metrics/ambari-metrics-anomaly-detection-service/pom.xml
index c9bb7b7..554d026 100644
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/pom.xml
+++ b/ambari-metrics/ambari-metrics-anomaly-detection-service/pom.xml
@@ -35,7 +35,7 @@
     <scala.version>2.12.3</scala.version>
     <scala.binary.version>2.11</scala.binary.version>
     <hadoop.version>2.7.3.2.6.0.3-8</hadoop.version>
-    <jackson.version>2.8.9</jackson.version>
+    <jackson.version>2.9.1</jackson.version>
     <dropwizard.version>1.2.0</dropwizard.version>
     <spark.version>2.2.0</spark.version>
   </properties>
@@ -223,6 +223,11 @@
       <version>0.10.1.0</version>
     </dependency>
     <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
       <groupId>org.apache.kafka</groupId>
       <artifactId>connect-json</artifactId>
       <version>0.10.1.0</version>
@@ -236,6 +241,28 @@
       <groupId>org.apache.phoenix</groupId>
       <artifactId>phoenix-spark</artifactId>
       <version>4.10.0-HBase-1.1</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>jersey-server</artifactId>
+          <groupId>com.sun.jersey</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>jersey-core</artifactId>
+          <groupId>com.sun.jersey</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>jersey-client</artifactId>
+          <groupId>com.sun.jersey</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>jersey-guice</artifactId>
+          <groupId>com.sun.jersey.contribs</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>jersey-json</artifactId>
+          <groupId>com.sun.jersey</groupId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.apache.ambari</groupId>
@@ -257,6 +284,12 @@
       <artifactId>spark-core_${scala.binary.version}</artifactId>
       <version>${spark.version}</version>
       <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>com.fasterxml.jackson.module</groupId>
+          <artifactId>jackson-module-scala_2.11</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.apache.spark</groupId>
@@ -286,6 +319,18 @@
           <groupId>org.mortbay.jetty</groupId>
           <artifactId>jsp-2.1-jetty</artifactId>
         </exclusion>
+        <exclusion>
+          <artifactId>jersey-server</artifactId>
+          <groupId>com.sun.jersey</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>jersey-core</artifactId>
+          <groupId>com.sun.jersey</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>jersey-json</artifactId>
+          <groupId>com.sun.jersey</groupId>
+        </exclusion>
       </exclusions>
     </dependency>
     <dependency>
@@ -385,5 +430,10 @@
       <version>21.0</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>io.dropwizard.metrics</groupId>
+      <artifactId>metrics-core</artifactId>
+      <version>3.2.5</version>
+    </dependency>
   </dependencies>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/b0164a14/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/java/org/apache/ambari/metrics/adservice/prototype/core/AmbariServerInterface.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/java/org/apache/ambari/metrics/adservice/prototype/core/AmbariServerInterface.java b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/java/org/apache/ambari/metrics/adservice/prototype/core/AmbariServerInterface.java
index 920d758..ac50c54 100644
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/java/org/apache/ambari/metrics/adservice/prototype/core/AmbariServerInterface.java
+++ b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/java/org/apache/ambari/metrics/adservice/prototype/core/AmbariServerInterface.java
@@ -20,8 +20,6 @@ package org.apache.ambari.metrics.adservice.prototype.core;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.codehaus.jettison.json.JSONArray;
-import org.codehaus.jettison.json.JSONObject;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -72,22 +70,22 @@ public class AmbariServerInterface implements Serializable{
         responseJsonSb.append(line);
       }
 
-      JSONObject jsonObject = new JSONObject(responseJsonSb.toString());
-      JSONArray array = jsonObject.getJSONArray("items");
-      for(int i = 0 ; i < array.length() ; i++){
-        JSONObject alertDefn = array.getJSONObject(i).getJSONObject("AlertDefinition");
-        if (alertDefn.get("name") != null && alertDefn.get("name").equals("point_in_time_metrics_anomalies")) {
-          JSONObject sourceNode = alertDefn.getJSONObject("source");
-          JSONArray params = sourceNode.getJSONArray("parameters");
-          for(int j = 0 ; j < params.length() ; j++){
-            JSONObject param = params.getJSONObject(j);
-            if (param.get("name").equals("sensitivity")) {
-              return param.getInt("value");
-            }
-          }
-          break;
-        }
-      }
+//      JSONObject jsonObject = new JSONObject(responseJsonSb.toString());
+//      JSONArray array = jsonObject.getJSONArray("items");
+//      for(int i = 0 ; i < array.length() ; i++){
+//        JSONObject alertDefn = array.getJSONObject(i).getJSONObject("AlertDefinition");
+//        if (alertDefn.get("name") != null && alertDefn.get("name").equals("point_in_time_metrics_anomalies")) {
+//          JSONObject sourceNode = alertDefn.getJSONObject("source");
+//          JSONArray params = sourceNode.getJSONArray("parameters");
+//          for(int j = 0 ; j < params.length() ; j++){
+//            JSONObject param = params.getJSONObject(j);
+//            if (param.get("name").equals("sensitivity")) {
+//              return param.getInt("value");
+//            }
+//          }
+//          break;
+//        }
+//      }
 
     } catch (Exception e) {
       LOG.error(e);

http://git-wip-us.apache.org/repos/asf/ambari/blob/b0164a14/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionApp.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionApp.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionApp.scala
index 2cf0fc5..b7f217e 100644
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionApp.scala
+++ b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionApp.scala
@@ -61,6 +61,8 @@ class AnomalyDetectionApp extends Application[AnomalyDetectionAppConfig] {
     provider.setMapper(objectMapper)
     provider
   }
+
+  override def bootstrapLogging(): Unit = {}
 }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b0164a14/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
index 40691d6..9c55305 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
@@ -41,6 +41,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.IntegrationTestingUtility;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.util.RetryCounterFactory;
 import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
 import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
 import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.aggregators.AggregatorUtils;
@@ -222,6 +223,18 @@ public abstract class AbstractMiniHBaseClusterTest extends BaseTest {
             }
             return connection;
           }
+
+          @Override
+          public Connection getConnectionRetryingOnException(RetryCounterFactory retryCounterFactory) throws SQLException, InterruptedException {
+            Connection connection = null;
+            try {
+              connection = DriverManager.getConnection(getUrl());
+            } catch (SQLException e) {
+              LOG.warn("Unable to connect to HBase store using Phoenix.", e);
+            }
+            return connection;
+          }
+
         });
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b0164a14/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
index 97d2512..5d81faa 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
@@ -22,6 +22,7 @@ import com.google.common.collect.Multimap;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.DoNotRetryIOException;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.util.RetryCounterFactory;
 import org.apache.hadoop.metrics2.sink.timeline.MetricClusterAggregate;
 import org.apache.hadoop.metrics2.sink.timeline.MetricHostAggregate;
 import org.apache.hadoop.metrics2.sink.timeline.Precision;
@@ -94,7 +95,12 @@ public class PhoenixHBaseAccessorTest {
       public Connection getConnection() throws SQLException {
         return null;
       }
-    };
+
+      @Override
+      public Connection getConnectionRetryingOnException(RetryCounterFactory retryCounterFactory) throws SQLException, InterruptedException {
+        return null;
+      }
+      };
 
     accessor = new PhoenixHBaseAccessor(connectionProvider);
   }
@@ -250,6 +256,11 @@ public class PhoenixHBaseAccessorTest {
       public Connection getConnection() throws SQLException {
         return connection;
       }
+
+      @Override
+      public Connection getConnectionRetryingOnException(RetryCounterFactory retryCounterFactory) throws SQLException, InterruptedException {
+        return connection;
+      }
     };
 
     accessor = new PhoenixHBaseAccessor(connectionProvider);