/** * free the slots. * * @param slots multiple slots to free */ public void freeSlots(Collection<WorkerSlot> slots) { if (slots != null) { for (WorkerSlot slot : slots) { freeSlot(slot); } } }
for (AssignmentInfo ass : assignments) { if (isoIds.contains(ass.getTopologyId())) { cluster.freeSlot(ass.getWorkerSlot());
/** * Frees all the slots for a topology. * @param topId the topology to free slots for * @param cluster the cluster to update */ public void freeTopology(String topId, Cluster cluster) { Set<WorkerSlot> slots = _topIdToUsedSlots.get(topId); if (slots == null || slots.isEmpty()) return; for (WorkerSlot ws : slots) { cluster.freeSlot(ws); if (_isAlive) { _freeSlots.add(ws); } } _topIdToUsedSlots.remove(topId); }
/** * Frees a single slot in this node * @param ws the slot to free * @param cluster the cluster to update */ public void free(WorkerSlot ws, Cluster cluster, boolean forceFree) { if (_freeSlots.contains(ws)) return; boolean wasFound = false; for (Entry<String, Set<WorkerSlot>> entry : _topIdToUsedSlots.entrySet()) { Set<WorkerSlot> slots = entry.getValue(); if (slots.remove(ws)) { cluster.freeSlot(ws); if (_isAlive) { _freeSlots.add(ws); } wasFound = true; } } if (!wasFound) { if (forceFree) { LOG.info("Forcefully freeing the " + ws); cluster.freeSlot(ws); _freeSlots.add(ws); } else { throw new IllegalArgumentException("Tried to free a slot that was not" + " part of this node " + _nodeId); } } }
/** * Frees a single slot in this node. * * @param ws the slot to free */ public void free(WorkerSlot ws) { LOG.debug("freeing WorkerSlot {} on node {}", ws, hostname); if (!slots.containsKey(ws.getId())) { throw new IllegalArgumentException( "Tried to free a slot " + ws + " that was not" + " part of this node " + nodeId); } TopologyDetails topo = findTopologyUsingWorker(ws); if (topo == null) { throw new IllegalArgumentException("Tried to free a slot " + ws + " that was already free!"); } //free slot cluster.freeSlot(ws); //cleanup internal assignments topIdToUsedSlots.get(topo.getId()).remove(ws.getId()); }
cluster.freeSlot(slot);
/** * free the slots. * * @param slots */ public void freeSlots(Collection<WorkerSlot> slots) { if(slots!=null) { for (WorkerSlot slot : slots) { this.freeSlot(slot); } } }
/** * Frees all the slots for a topology. * @param topId the topology to free slots for * @param cluster the cluster to update */ public void freeTopology(String topId, Cluster cluster) { Set<WorkerSlot> slots = _topIdToUsedSlots.get(topId); if (slots == null || slots.isEmpty()) return; for (WorkerSlot ws : slots) { cluster.freeSlot(ws); if (_isAlive) { _freeSlots.add(ws); } } _topIdToUsedSlots.remove(topId); }
/** * Frees a single slot in this node * @param ws the slot to free */ public void free(WorkerSlot ws) { LOG.info("freeing WorkerSlot {} on node {}", ws, _hostname); if (!_slots.containsKey(ws.getId())) { throw new IllegalArgumentException("Tried to free a slot " + ws + " that was not" + " part of this node " + _nodeId); } TopologyDetails topo = findTopologyUsingWorker(ws); if (topo == null) { throw new IllegalArgumentException("Tried to free a slot " + ws + " that was already free!"); } double memUsed = getMemoryUsedByWorker(ws); double cpuUsed = getCpuUsedByWorker(ws); freeMemory(memUsed); freeCPU(cpuUsed); //free slot _cluster.freeSlot(ws); //cleanup internal assignments _topIdToUsedSlots.get(topo.getId()).remove(ws.getId()); }