storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [2/4] storm git commit: add a +1 in the denominator to deal with the case if available resources is zero
Date Thu, 05 Nov 2015 21:22:13 GMT
add a +1 in the denominator to deal with the case if available resources is zero


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/f35ce601
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/f35ce601
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/f35ce601

Branch: refs/heads/master
Commit: f35ce6016ad519dced9aff44bb8458cc02740f93
Parents: 780a472
Author: Boyang Jerry Peng <jerrypeng@yahoo-inc.com>
Authored: Wed Nov 4 09:57:59 2015 -0600
Committer: Boyang Jerry Peng <jerrypeng@yahoo-inc.com>
Committed: Wed Nov 4 11:05:23 2015 -0600

----------------------------------------------------------------------
 .../scheduler/resource/strategies/ResourceAwareStrategy.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/f35ce601/storm-core/src/jvm/backtype/storm/scheduler/resource/strategies/ResourceAwareStrategy.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/scheduler/resource/strategies/ResourceAwareStrategy.java
b/storm-core/src/jvm/backtype/storm/scheduler/resource/strategies/ResourceAwareStrategy.java
index 754633c..f98d9ed 100644
--- a/storm-core/src/jvm/backtype/storm/scheduler/resource/strategies/ResourceAwareStrategy.java
+++ b/storm-core/src/jvm/backtype/storm/scheduler/resource/strategies/ResourceAwareStrategy.java
@@ -210,9 +210,9 @@ public class ResourceAwareStrategy implements IStrategy {
             if(n.getFreeSlots().size()>0) {
                 if (n.getAvailableMemoryResources() >= taskMem
                         && n.getAvailableCpuResources() >= taskCPU) {
-                    double a = Math.pow(((taskCPU - n.getAvailableCpuResources())/n.getAvailableCpuResources())
+                    double a = Math.pow(((taskCPU - n.getAvailableCpuResources())/(n.getAvailableCpuResources()
+ 1))
                             * this.CPU_WEIGHT, 2);
-                    double b = Math.pow(((taskMem - n.getAvailableMemoryResources())/n.getAvailableMemoryResources())
+                    double b = Math.pow(((taskMem - n.getAvailableMemoryResources())/(n.getAvailableMemoryResources()
+ 1))
                             * this.MEM_WEIGHT, 2);
                     double c = 0.0;
                     if(this.refNode != null) {


Mime
View raw message