Github user revans2 commented on a diff in the pull request:
https://github.com/apache/storm/pull/2385#discussion_r149161531
--- Diff:
storm-server/src/main/java/org/apache/storm/scheduler/Cluster.java ---
@@ -503,43 +553,42 @@ public boolean wouldFit(
WorkerSlot ws,
ExecutorDetails exec,
TopologyDetails td,
- double maxHeap,
- double memoryAvailable,
- double cpuAvailable) {
- //NOTE this is called lots and lots by schedulers, so anything we
can do to make it faster is going to help a lot.
- //CPU is simplest because it does not have odd interactions.
- double cpuNeeded = td.getTotalCpuReqTask(exec);
- if (cpuNeeded > cpuAvailable) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Could not schedule {}:{} on {} not enough CPU
{} > {}",
- td.getName(),
- exec,
- ws,
- cpuNeeded,
- cpuAvailable);
- }
- //Not enough CPU no need to try any more
- return false;
- }
+ Map<String, Double> resourcesAvailable,
+ double maxHeap) {
- //Lets see if we can make the Memory one fast too, at least in the
failure case.
- //The totalMemReq is not really that accurate because it does not
include shared memory, but if it does not fit we know
- // Even with shared it will not work
- double minMemNeeded = td.getTotalMemReqTask(exec);
- if (minMemNeeded > memoryAvailable) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Could not schedule {}:{} on {} not enough Mem
{} > {}", td.getName(), exec, ws, minMemNeeded, memoryAvailable);
+ Map<String, Double> requestedResources =
td.getTotalResources(exec);
+
+ for (Entry resourceNeededEntry : requestedResources.entrySet()) {
+ String resourceName = resourceNeededEntry.getKey().toString();
--- End diff --
Why are we calling toString on a String?
---