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

 ##########
 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:
   Replaced 1000 with component count.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to