Github user redsanket commented on a diff in the pull request: https://github.com/apache/storm/pull/856#discussion_r43921298 --- Diff: storm-core/src/jvm/backtype/storm/scheduler/resource/strategies/ResourceAwareStrategy.java --- @@ -209,18 +209,18 @@ private WorkerSlot getBestWorker(ExecutorDetails exec, TopologyDetails td, Strin for (RAS_Node n : nodes) { if(n.getFreeSlots().size()>0) { if (n.getAvailableMemoryResources() >= taskMem - && n.getAvailableCpuResources() >= taskCPU) { - double a = Math.pow((taskCPU - n.getAvailableCpuResources()) - * this.CPU_WEIGHT, 2); - double b = Math.pow((taskMem - n.getAvailableMemoryResources()) - * this.MEM_WEIGHT, 2); - double c = 0.0; - if(this.refNode != null) { - c = Math.pow(this.distToNode(this.refNode, n) - * this.NETWORK_WEIGHT, 2); - } - double distance = Math.sqrt(a + b + c); - nodeRankMap.put(distance, n); + && n.getAvailableCpuResources() >= taskCPU) { + double a = Math.pow(((taskCPU - n.getAvailableCpuResources())/(n.getAvailableCpuResources() + 1)) + * this.CPU_WEIGHT, 2); + double b = Math.pow(((taskMem - n.getAvailableMemoryResources())/(n.getAvailableMemoryResources() + 1)) + * this.MEM_WEIGHT, 2); + double c = 0.0; + if(this.refNode != null) { + c = Math.pow(this.distToNode(this.refNode, n) + * this.NETWORK_WEIGHT, 2); + } + double distance = Math.sqrt(a + b + c); + nodeRankMap.put(distance, n); --- End diff -- sorry never mind +1 NB
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---