[incubator-heron] branch huijunw/healthmgrmetrics updated: fix style

2018-04-04 Thread huijun
This is an automated email from the ASF dual-hosted git repository.

huijun pushed a commit to branch huijunw/healthmgrmetrics
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


The following commit(s) were added to refs/heads/huijunw/healthmgrmetrics by 
this push:
 new ac352b5  fix style
ac352b5 is described below

commit ac352b5a6583319c647576fdeeddc82add8aac91
Author: Huijun Wu 
AuthorDate: Wed Apr 4 16:47:37 2018 -0700

fix style
---
 .../src/java/com/twitter/heron/healthmgr/HealthManagerMetrics.java| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/heron/healthmgr/src/java/com/twitter/heron/healthmgr/HealthManagerMetrics.java
 
b/heron/healthmgr/src/java/com/twitter/heron/healthmgr/HealthManagerMetrics.java
index f1e5834..fab5c70 100644
--- 
a/heron/healthmgr/src/java/com/twitter/heron/healthmgr/HealthManagerMetrics.java
+++ 
b/heron/healthmgr/src/java/com/twitter/heron/healthmgr/HealthManagerMetrics.java
@@ -23,6 +23,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import com.google.protobuf.Message;
+
 import com.twitter.heron.api.metric.MultiCountMetric;
 import com.twitter.heron.common.basics.NIOLooper;
 import com.twitter.heron.common.basics.SingletonRegistry;
@@ -61,7 +62,6 @@ public class HealthManagerMetrics implements Runnable, 
AutoCloseable {
 
   /**
* constructor to expose healthmgr metrics to local metricsmgr
-   * 
* @param metricsMgrPort local MetricsMgr port
* @throws IOException
*/
@@ -141,7 +141,7 @@ public class HealthManagerMetrics implements Runnable, 
AutoCloseable {
   public synchronized void executeIncr(String metricName) {
 executeCount.scope(metricName).incr();
   }
-  
+
   public synchronized void executeSensorIncr(String sensor) {
 executeSensorCount.scope(sensor).incr();
   }

-- 
To stop receiving notification emails like this one, please contact
hui...@apache.org.


[incubator-heron] branch huijunw/togglemetricscacheconnectioninstmgr updated: added one line comment

2018-04-04 Thread huijun
This is an automated email from the ASF dual-hosted git repository.

huijun pushed a commit to branch huijunw/togglemetricscacheconnectioninstmgr
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


The following commit(s) were added to 
refs/heads/huijunw/togglemetricscacheconnectioninstmgr by this push:
 new c2d8640  added one line comment
c2d8640 is described below

commit c2d86404038f72631a6cba5a6815b953f5ed5b8f
Author: Huijun Wu 
AuthorDate: Wed Apr 4 16:05:46 2018 -0700

added one line comment
---
 heron/stmgr/src/cpp/manager/stmgr.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/heron/stmgr/src/cpp/manager/stmgr.h 
b/heron/stmgr/src/cpp/manager/stmgr.h
index ae63459..cd0d0da 100644
--- a/heron/stmgr/src/cpp/manager/stmgr.h
+++ b/heron/stmgr/src/cpp/manager/stmgr.h
@@ -255,6 +255,7 @@ class StMgr {
   sp_int64 high_watermark_;
   sp_int64 low_watermark_;
 
+  // whether MetricsCacheMgr is running
   sp_string metricscachemgr_mode_;
 };
 

-- 
To stop receiving notification emails like this one, please contact
hui...@apache.org.


[incubator-heron] branch master updated: Add json format for dry-run (#2842)

2018-04-04 Thread yaliang
This is an automated email from the ASF dual-hosted git repository.

yaliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


The following commit(s) were added to refs/heads/master by this push:
 new 9f3def0  Add json format for dry-run (#2842)
9f3def0 is described below

commit 9f3def0238f5d845a8217bc131d0da849e38c98a
Author: Andrew Jorgensen 
AuthorDate: Wed Apr 4 18:39:03 2018 -0400

Add json format for dry-run (#2842)

This adds JSON as an optional format for the dry-run output. JSON is
more easily machine readable than the other output formats and can be
used to make deploy decisions based on the resources required and the
resources available at deploy time.
---
 .../heron/common/basics/DryRunFormatType.java  |  3 +-
 heron/scheduler-core/src/java/BUILD| 15 ++--
 .../heron/scheduler/dryrun/JsonFormatterUtils.java | 87 ++
 .../scheduler/dryrun/SubmitJsonDryRunRenderer.java | 44 +++
 .../scheduler/dryrun/UpdateJsonDryRunRenderer.java | 57 ++
 .../heron/scheduler/utils/DryRunRenders.java   |  7 ++
 heron/scheduler-core/tests/java/BUILD  | 71 +-
 .../scheduler/dryrun/JsonFormatterUtilsTest.java   | 70 +
 .../resources/JsonFormatterUtilsExpectedJson.txt   |  1 +
 heron/tools/cli/src/python/args.py |  2 +-
 10 files changed, 313 insertions(+), 44 deletions(-)

diff --git 
a/heron/common/src/java/com/twitter/heron/common/basics/DryRunFormatType.java 
b/heron/common/src/java/com/twitter/heron/common/basics/DryRunFormatType.java
index ff85d4f..407ac4c 100644
--- 
a/heron/common/src/java/com/twitter/heron/common/basics/DryRunFormatType.java
+++ 
b/heron/common/src/java/com/twitter/heron/common/basics/DryRunFormatType.java
@@ -20,7 +20,8 @@ package com.twitter.heron.common.basics;
 public enum DryRunFormatType {
   RAW,
   TABLE,
-  COLORED_TABLE;
+  COLORED_TABLE,
+  JSON;
 
   public static DryRunFormatType getDryRunFormatType(String dryRunFormatType) {
 return DryRunFormatType.valueOf(dryRunFormatType.toUpperCase());
diff --git a/heron/scheduler-core/src/java/BUILD 
b/heron/scheduler-core/src/java/BUILD
index 30aa30b..b471af4 100644
--- a/heron/scheduler-core/src/java/BUILD
+++ b/heron/scheduler-core/src/java/BUILD
@@ -1,13 +1,14 @@
 package(default_visibility = ["//visibility:public"])
 
 common_deps_files = [
-   "//heron/common/src/java:basics-java",
-   "//heron/common/src/java:config-java",
-   "//heron/common/src/java:utils-java",
-   "//heron/api/src/java:classification",
-   "@commons_cli_commons_cli//jar",
-   "@com_google_guava_guava//jar",
-   "@org_apache_commons_commons_lang3//jar",
+"//heron/common/src/java:basics-java",
+"//heron/common/src/java:config-java",
+"//heron/common/src/java:utils-java",
+"//heron/api/src/java:classification",
+"@commons_cli_commons_cli//jar",
+"@com_google_guava_guava//jar",
+"@org_apache_commons_commons_lang3//jar",
+"//third_party/java:jackson",
 ]
 
 spi_deps_files = [
diff --git 
a/heron/scheduler-core/src/java/com/twitter/heron/scheduler/dryrun/JsonFormatterUtils.java
 
b/heron/scheduler-core/src/java/com/twitter/heron/scheduler/dryrun/JsonFormatterUtils.java
new file mode 100644
index 000..c2c0b6c
--- /dev/null
+++ 
b/heron/scheduler-core/src/java/com/twitter/heron/scheduler/dryrun/JsonFormatterUtils.java
@@ -0,0 +1,87 @@
+//  Copyright 2018 Twitter. All rights reserved.
+//
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+package com.twitter.heron.scheduler.dryrun;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import com.twitter.heron.spi.packing.PackingPlan;
+import com.twitter.heron.spi.packing.Resource;
+
+public class JsonFormatterUtils {
+
+  private final ObjectMapper mapper;
+
+  public JsonFormatterUtils() {
+mapper = new ObjectMapper();
+  }
+
+  public String renderPackingPlan(String topologyName, String packingClass,
+  PackingPlan packingPlan) throws 
JsonProcessingException {
+ObjectNode topLevel = mapper.createObjectNode();
+topLevel.put("packingClass", packingClass);
+topLevel.put("topology", topologyName);
+
+ArrayNode