@Override public void update(String nodeId, NodeCapacity nodeCapacity) throws HyracksException { // Removes the existing node resource and the aggregated resource statistics. if (nodeMemoryMap.containsKey(nodeId)) { aggregatedMemoryByteSize -= nodeMemoryMap.remove(nodeId); } if (nodeCoreMap.containsKey(nodeId)) { aggregatedCores -= nodeCoreMap.remove(nodeId); } long memorySize = nodeCapacity.getMemoryByteSize(); int cores = nodeCapacity.getCores(); // Updates the node capacity map when both memory size and cores are positive. if (memorySize > 0 && cores > 0) { aggregatedMemoryByteSize += memorySize; aggregatedCores += cores; nodeMemoryMap.put(nodeId, memorySize); nodeCoreMap.put(nodeId, cores); } }
private NodeCapacity getAdjustedNodeCapacity(NodeCapacity nodeCapacity) { return new NodeCapacity(nodeCapacity.getMemoryByteSize(), nodeCapacity.getCores() * nodeCoresMultiplier); }
@Override public Map<String, NodeControllerInfo> getNodeControllerInfoMap() { Map<String, NodeControllerInfo> result = new LinkedHashMap<>(); nodeRegistry.forEach( (key, ncState) -> result.put(key, new NodeControllerInfo(key, NodeStatus.ACTIVE, ncState.getDataPort(), ncState.getResultPort(), ncState.getMessagingPort(), ncState.getCapacity().getCores()))); return result; }
put(o, "nonheap-max-sizes", nonheapMaxSize); put(o, "application-memory-budget", capacity.getMemoryByteSize()); put(o, "application-cpu-core-budget", capacity.getCores()); put(o, "thread-counts", threadCount); put(o, "peak-thread-counts", peakThreadCount);