/** * Gets the available memory resources for this node. * * @return the available memory for this node */ public double getAvailableMemoryResources() { return getTotalAvailableResources().getTotalMemoryMb(); }
/** * Gets the available cpu resources for this node. * * @return the available cpu for this node */ public double getAvailableCpuResources() { return getTotalAvailableResources().getTotalCpu(); }
/** * Is there any possibility that exec could ever fit on this node. * @param exec the executor to schedule * @param td the topology the executor is a part of * @return true if there is the possibility it might fit, no guarantee that it will, or false if there is no * way it would ever fit. */ public boolean couldEverFit(ExecutorDetails exec, TopologyDetails td) { NormalizedResourceOffer avail = getTotalAvailableResources(); NormalizedResourceRequest requestedResources = td.getTotalResources(exec); return isAlive && avail.couldHoldIgnoringSharedMemory(requestedResources); }
/** * Would scheduling exec in ws fit with the current resource constraints. * * @param ws the slot to possibly put exec in * @param exec the executor to possibly place in ws * @param td the topology exec is a part of * @return true if it would fit else false */ public boolean wouldFit(WorkerSlot ws, ExecutorDetails exec, TopologyDetails td) { assert nodeId.equals(ws.getNodeId()) : "Slot " + ws + " is not a part of this node " + nodeId; return isAlive && cluster.wouldFit( ws, exec, td, getTotalAvailableResources(), td.getTopologyWorkerMaxHeapSize() ); }
private AllResources createClusterAllResources() { AllResources allResources = new AllResources("Cluster"); List<ObjectResources> racks = allResources.objectResources; //This is the first time so initialize the resources. for (Map.Entry<String, List<String>> entry : networkTopography.entrySet()) { String rackId = entry.getKey(); List<String> nodeHosts = entry.getValue(); ObjectResources rack = new ObjectResources(rackId); racks.add(rack); for (String nodeHost : nodeHosts) { for (RAS_Node node : hostnameToNodes(nodeHost)) { rack.availableResources.add(node.getTotalAvailableResources()); rack.totalResources.add(node.getTotalAvailableResources()); } } allResources.totalResourcesOverall.add(rack.totalResources); allResources.availableResourcesOverall.add(rack.availableResources); } LOG.debug( "Cluster Overall Avail [ {} ] Total [ {} ]", allResources.availableResourcesOverall, allResources.totalResourcesOverall); return allResources; }
ObjectResources node = new ObjectResources(superId); node.availableResources = rasNode.getTotalAvailableResources(); node.totalResources = rasNode.getTotalResources();