public MockBasicContainer(ContainerType type, Map<String, Object> conf, String supervisorId, int supervisorPort, int port, LocalAssignment assignment, ResourceIsolationInterface resourceIsolationManager, LocalState localState, String workerId, StormMetricsRegistry metricsRegistry, Map<String, Object> topoConf, AdvancedFSOps ops, String profileCmd) throws IOException { super(type, conf, supervisorId, supervisorPort, port, assignment, resourceIsolationManager, localState, workerId, metricsRegistry,new ContainerMemoryTracker(metricsRegistry), topoConf, ops, profileCmd); }
/** * Get the number of workers for this topology. */ public long getTotalWorkersForThisTopology() { return containerMemoryTracker.getAssignedWorkerCount(_topologyId); }
/** * Get the total memory used (on and off heap). */ public long getTotalTopologyMemoryUsed() { updateMemoryAccounting(); return containerMemoryTracker.getUsedMemoryMb(_topologyId); }
protected void updateMemoryAccounting() { _type.assertFull(); long used = getMemoryUsageMb(); long reserved = getMemoryReservationMb(); containerMemoryTracker.setUsedMemoryMb(_port, _topologyId, used); containerMemoryTracker.setReservedMemoryMb(_port, _topologyId, reserved); }
@Override public void cleanUp() throws IOException { try (Timer.Context t = cleanupDuration.time()) { containerMemoryTracker.remove(_port); cleanUpForRestart(); } catch (IOException e) { //This may or may not be reported depending on when process exits numCleanupExceptions.mark(); throw e; } }
/** * Get the total memory reserved. * * @param withUpdatedLimits the local assignment with shared memory * @return the total memory reserved. */ public long getTotalTopologyMemoryReserved(LocalAssignment withUpdatedLimits) { updateMemoryAccounting(); long ret = containerMemoryTracker.getReservedMemoryMb(_topologyId); if (withUpdatedLimits.is_set_total_node_shared()) { ret += withUpdatedLimits.get_total_node_shared(); } return ret; }
protected MockContainer(ContainerType type, Map<String, Object> conf, String supervisorId, int supervisorPort, int port, LocalAssignment assignment, ResourceIsolationInterface resourceIsolationManager, String workerId, Map<String, Object> topoConf, AdvancedFSOps ops, StormMetricsRegistry metricsRegistry) throws IOException { super(type, conf, supervisorId, supervisorPort, port, assignment, resourceIsolationManager, workerId, topoConf, ops, metricsRegistry, new ContainerMemoryTracker(new StormMetricsRegistry())); }
Optional<Long> usedMemoryForPort = containerMemoryTracker.getUsedMemoryMb(_port); if (usedMemoryForPort.isPresent()) {
this.conf = conf; this.metricsRegistry = metricsRegistry; this.containerMemoryTracker = new ContainerMemoryTracker(metricsRegistry); this.slotMetrics = new SlotMetrics(metricsRegistry); this.iSupervisor = iSupervisor;