You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by GitBox <gi...@apache.org> on 2020/02/26 17:10:05 UTC

[GitHub] [storm] kishorvpatil commented on a change in pull request #3215: Storm3585 - New compact Constraint config including maxCoLocationCnt

kishorvpatil commented on a change in pull request #3215: Storm3585 - New compact Constraint config including maxCoLocationCnt
URL: https://github.com/apache/storm/pull/3215#discussion_r384636994
 
 

 ##########
 File path: storm-server/src/main/java/org/apache/storm/scheduler/resource/strategies/scheduling/ConstraintSolverStrategy.java
 ##########
 @@ -447,22 +518,24 @@ public boolean isExecAssignmentToWorkerValid(WorkerSlot worker, SearcherState st
         return retMap;
     }
 
-    private ArrayList<ExecutorDetails> getSortedExecs(HashSet<String> spreadComps, Map<String, Map<String, Integer>> constraintMatrix,
+    private ArrayList<ExecutorDetails> getSortedExecs(Map<String, Integer> spreadCompCnts,
+                                                      Map<String, Set<String>> constraintMatrix,
                                                       Map<String, Set<ExecutorDetails>> compToExecs) {
         ArrayList<ExecutorDetails> retList = new ArrayList<>();
         //find number of constraints per component
         //Key->Comp Value-># of constraints
-        Map<String, Integer> compConstraintCountMap = new HashMap<>();
+        Map<String, Double> compConstraintCountMap = new HashMap<>();
         constraintMatrix.forEach((comp, subMatrix) -> {
-            int count = subMatrix.values().stream().mapToInt(Number::intValue).sum();
-            //check component is declared for spreading
-            if (spreadComps.contains(comp)) {
-                count++;
+            double count = subMatrix.size();
+            // check if component is declared for spreading
+            if (spreadCompCnts.containsKey(comp)) {
+                // lower (1 and above only) value is most constrained should have higher count
+                count += (1_000.0 / spreadCompCnts.get(comp));
 
 Review comment:
   Instead of using large number this should be function on total executors requested by topology.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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