You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by GitBox <gi...@apache.org> on 2018/07/20 13:36:26 UTC

[GitHub] huijunwu closed pull request #2968: Upgrade to the latest Dhalion

huijunwu closed pull request #2968: Upgrade to the latest Dhalion
URL: https://github.com/apache/incubator-heron/pull/2968
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/WORKSPACE b/WORKSPACE
index 0f4d93263e..bb622b9167 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -460,7 +460,7 @@ maven_jar(
 
 maven_jar(
   name = "com_microsoft_dhalion",
-  artifact = "com.microsoft.dhalion:dhalion:0.2.1",
+  artifact = "com.microsoft.dhalion:dhalion:0.2.3",
 )
 
 maven_jar(
diff --git a/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/DynamicResourceAllocationPolicy.java b/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/DynamicResourceAllocationPolicy.java
index 45293f0bdc..f0f1092d99 100644
--- a/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/DynamicResourceAllocationPolicy.java
+++ b/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/DynamicResourceAllocationPolicy.java
@@ -21,11 +21,12 @@
 
 import java.time.Duration;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.logging.Logger;
 
 import javax.inject.Inject;
 
-import com.microsoft.dhalion.api.IResolver;
+import com.microsoft.dhalion.core.Action;
 import com.microsoft.dhalion.core.Diagnosis;
 import com.microsoft.dhalion.core.DiagnosisTable;
 import com.microsoft.dhalion.events.EventHandler;
@@ -92,7 +93,7 @@
   }
 
   @Override
-  public IResolver selectResolver(Collection<Diagnosis> diagnosis) {
+  public Collection<Action> executeResolvers(Collection<Diagnosis> diagnosis) {
     DiagnosisTable diagnosisTable = DiagnosisTable.of(diagnosis);
 
     if (diagnosisTable.type(DIAGNOSIS_DATA_SKEW.text()).size() > 0) {
@@ -100,10 +101,10 @@ public IResolver selectResolver(Collection<Diagnosis> diagnosis) {
     } else if (diagnosisTable.type(DIAGNOSIS_SLOW_INSTANCE.text()).size() > 0) {
       LOG.warning("Slow Instance diagnoses. This diagnosis does not have any resolver.");
     } else if (diagnosisTable.type(DIAGNOSIS_UNDER_PROVISIONING.text()).size() > 0) {
-      return scaleUpResolver;
+      return scaleUpResolver.resolve(diagnosis);
     }
 
-    return null;
+    return Collections.EMPTY_LIST;
   }
 
   @Override
diff --git a/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/ToggleablePolicy.java b/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/ToggleablePolicy.java
index a55764ef27..e88ab5a487 100644
--- a/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/ToggleablePolicy.java
+++ b/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/ToggleablePolicy.java
@@ -21,6 +21,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.logging.Logger;
 
 import javax.inject.Inject;
@@ -97,7 +98,7 @@ public ToggleablePolicy(
     if (policyMode.equals(PolicyMode.activated)) {
       return super.executeSensors();
     } else {
-      return new ArrayList<Measurement>();
+      return Collections.EMPTY_LIST;
     }
   }
 
@@ -106,7 +107,7 @@ public ToggleablePolicy(
     if (policyMode.equals(PolicyMode.activated)) {
       return super.executeDetectors(measurements);
     } else {
-      return new ArrayList<Symptom>();
+      return Collections.EMPTY_LIST;
     }
   }
 
@@ -115,7 +116,7 @@ public ToggleablePolicy(
     if (policyMode.equals(PolicyMode.activated)) {
       return super.executeDiagnosers(symptoms);
     } else {
-      return new ArrayList<Diagnosis>();
+      return Collections.EMPTY_LIST;
     }
   }
 
diff --git a/heron/healthmgr/src/java/org/apache/heron/healthmgr/resolvers/RestartContainerResolver.java b/heron/healthmgr/src/java/org/apache/heron/healthmgr/resolvers/RestartContainerResolver.java
index 44b91aaf55..85a624c898 100644
--- a/heron/healthmgr/src/java/org/apache/heron/healthmgr/resolvers/RestartContainerResolver.java
+++ b/heron/healthmgr/src/java/org/apache/heron/healthmgr/resolvers/RestartContainerResolver.java
@@ -20,10 +20,9 @@
 package org.apache.heron.healthmgr.resolvers;
 
 import java.time.Instant;
-import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashSet;
-import java.util.List;
 import java.util.logging.Logger;
 
 import javax.inject.Inject;
@@ -74,7 +73,6 @@ public void initialize(ExecutionContext ctxt) {
   public Collection<Action> resolve(Collection<Diagnosis> diagnosis) {
     publishingMetrics.executeResolver(RESTART_CONTAINER_RESOLVER);
 
-    List<Action> actions = new ArrayList<>();
 
     // find all back pressure measurements reported in this execution cycle
     Instant current = context.checkpoint();
@@ -85,7 +83,7 @@ public void initialize(ExecutionContext ctxt) {
 
     if (bpSymptoms.size() == 0) {
       LOG.fine("No back-pressure measurements found, ending as there's nothing to fix");
-      return actions;
+      return Collections.EMPTY_LIST;
     }
 
     Collection<String> allBpInstances = new HashSet<>();
@@ -116,7 +114,6 @@ public void initialize(ExecutionContext ctxt) {
     LOG.info("Broadcasting container restart event");
     ContainerRestart action = new ContainerRestart(current, stmgrIds);
     eventManager.onEvent(action);
-    actions.add(action);
-    return actions;
+    return Collections.singletonList(action);
   }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services