You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by hu...@apache.org on 2018/06/27 22:14:55 UTC
[incubator-heron] branch huijunw/togglepolicy updated: fix ning
comment
This is an automated email from the ASF dual-hosted git repository.
huijun pushed a commit to branch huijunw/togglepolicy
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git
The following commit(s) were added to refs/heads/huijunw/togglepolicy by this push:
new cc3615c fix ning comment
cc3615c is described below
commit cc3615c7c87bb16b61090b2843d248e89d6d0474
Author: Huijun Wu <hu...@twitter.com>
AuthorDate: Wed Jun 27 15:14:36 2018 -0700
fix ning comment
---
heron/config/src/yaml/conf/local/healthmgr.yaml | 2 ++
heron/config/src/yaml/conf/sandbox/healthmgr.yaml | 2 ++
heron/config/src/yaml/conf/yarn/healthmgr.yaml | 2 ++
.../org/apache/heron/healthmgr/HealthPolicyConfig.java | 14 ++++++++++----
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/heron/config/src/yaml/conf/local/healthmgr.yaml b/heron/config/src/yaml/conf/local/healthmgr.yaml
index 7fbd4ef..d5d93d9 100644
--- a/heron/config/src/yaml/conf/local/healthmgr.yaml
+++ b/heron/config/src/yaml/conf/local/healthmgr.yaml
@@ -35,12 +35,14 @@ heron.class.health.policies:
- auto-restart-backpressure-container
## configuration specific to individual policies listed above
+
#dynamic-resource-allocation:
# health.policy.mode: deactivated
# health.policy.class: org.apache.heron.healthmgr.policy.DynamicResourceAllocationPolicy
# health.policy.interval.ms: 120000
# BackPressureDetector.noiseFilterMillis: 20
# GrowingWaitQueueDetector.limit: 5
+
auto-restart-backpressure-container:
# policy toggle value:
# deactivated = freeze this policy
diff --git a/heron/config/src/yaml/conf/sandbox/healthmgr.yaml b/heron/config/src/yaml/conf/sandbox/healthmgr.yaml
index 7fbd4ef..d5d93d9 100644
--- a/heron/config/src/yaml/conf/sandbox/healthmgr.yaml
+++ b/heron/config/src/yaml/conf/sandbox/healthmgr.yaml
@@ -35,12 +35,14 @@ heron.class.health.policies:
- auto-restart-backpressure-container
## configuration specific to individual policies listed above
+
#dynamic-resource-allocation:
# health.policy.mode: deactivated
# health.policy.class: org.apache.heron.healthmgr.policy.DynamicResourceAllocationPolicy
# health.policy.interval.ms: 120000
# BackPressureDetector.noiseFilterMillis: 20
# GrowingWaitQueueDetector.limit: 5
+
auto-restart-backpressure-container:
# policy toggle value:
# deactivated = freeze this policy
diff --git a/heron/config/src/yaml/conf/yarn/healthmgr.yaml b/heron/config/src/yaml/conf/yarn/healthmgr.yaml
index 7fbd4ef..d5d93d9 100644
--- a/heron/config/src/yaml/conf/yarn/healthmgr.yaml
+++ b/heron/config/src/yaml/conf/yarn/healthmgr.yaml
@@ -35,12 +35,14 @@ heron.class.health.policies:
- auto-restart-backpressure-container
## configuration specific to individual policies listed above
+
#dynamic-resource-allocation:
# health.policy.mode: deactivated
# health.policy.class: org.apache.heron.healthmgr.policy.DynamicResourceAllocationPolicy
# health.policy.interval.ms: 120000
# BackPressureDetector.noiseFilterMillis: 20
# GrowingWaitQueueDetector.limit: 5
+
auto-restart-backpressure-container:
# policy toggle value:
# deactivated = freeze this policy
diff --git a/heron/healthmgr/src/java/org/apache/heron/healthmgr/HealthPolicyConfig.java b/heron/healthmgr/src/java/org/apache/heron/healthmgr/HealthPolicyConfig.java
index fc9cc8f..0cba8cb 100644
--- a/heron/healthmgr/src/java/org/apache/heron/healthmgr/HealthPolicyConfig.java
+++ b/heron/healthmgr/src/java/org/apache/heron/healthmgr/HealthPolicyConfig.java
@@ -33,6 +33,7 @@ public class HealthPolicyConfig {
public static final String CONF_POLICY_ID = "POLICY_ID";
public static final String CONF_POLICY_MODE_DEACTIVATED = "deactivated";
+ public static final String CONF_POLICY_MODE_ACTIVATED = "activated";
private static final Logger LOG = Logger.getLogger(HealthPolicyConfig.class.getName());
private final Map<String, Object> configs;
@@ -48,10 +49,15 @@ public class HealthPolicyConfig {
public ToggleablePolicy.PolicyMode getPolicyMode() {
String configKey = PolicyConfigKey.HEALTH_POLICY_MODE.key();
- if (configs.containsKey(configKey)
- && CONF_POLICY_MODE_DEACTIVATED.equals(
- (String) configs.get(PolicyConfigKey.HEALTH_POLICY_MODE.key()))) {
- return ToggleablePolicy.PolicyMode.deactivated;
+ if (configs.containsKey(configKey)) {
+ String val = (String) configs.get(PolicyConfigKey.HEALTH_POLICY_MODE.key());
+ if (CONF_POLICY_MODE_DEACTIVATED.equals(val)) {
+ return ToggleablePolicy.PolicyMode.deactivated;
+ } else if (CONF_POLICY_MODE_ACTIVATED.equals(val)) {
+ return ToggleablePolicy.PolicyMode.activated;
+ } else {
+ LOG.warning("unknown policy mode config " + val);
+ }
}
return ToggleablePolicy.PolicyMode.activated;
}