protected void updateMemoryAccounting() { _type.assertFull(); long used = getMemoryUsageMb(); long reserved = getMemoryReservationMb(); containerMemoryTracker.setUsedMemoryMb(_port, _topologyId, used); containerMemoryTracker.setReservedMemoryMb(_port, _topologyId, reserved); }
@Override public void relaunch() throws IOException { _type.assertFull(); //We are launching it now... _type = ContainerType.LAUNCH; createNewWorkerId(); setup(); launch(); }
@Override public Container launchContainer(int port, LocalAssignment assignment, LocalState state) throws IOException { Container container = new BasicContainer(ContainerType.LAUNCH, _conf, _supervisorId, _supervisorPort, port, assignment, _resourceIsolationManager, state, null, metricsRegistry, containerMemoryTracker); container.setup(); container.launch(); return container; }
public void shutdownAllWorkers(UniFunc<Slot> onWarnTimeout, UniFunc<Slot> onErrorTimeout) { if (readState != null) { readState.shutdownAllWorkers(onWarnTimeout, onErrorTimeout); } else { try { ContainerLauncher launcher = ContainerLauncher.make(getConf(), getId(), getThriftServerPort(), getSharedContext(), getMetricsRegistry(), getContainerMemoryTracker()); killWorkers(SupervisorUtils.supervisorWorkerIds(conf), launcher); } catch (Exception e) { throw Utils.wrapInRuntime(e); } } }
@Override public Container launchContainer(int port, LocalAssignment assignment, LocalState state) throws IOException { Container container = new RunAsUserContainer(ContainerType.LAUNCH, _conf, _supervisorId, _supervisorPort, port, assignment, _resourceIsolationManager, state, null, metricsRegistry, containerMemoryTracker, null, null, null); container.setup(); container.launch(); return container; }
@Override public Container launchContainer(int port, LocalAssignment assignment, LocalState state) throws IOException { LocalContainer ret = new LocalContainer(_conf, _supervisorId, _supervisorPort, port, assignment, _sharedContext, metricsRegistry, containerMemoryTracker); ret.setup(); ret.launch(); return ret; }
public DynamicState withProfileActions(Set<TopoProfileAction> profileActions, Set<TopoProfileAction> pendingStopProfileActions) { return new DynamicState(this.state, this.newAssignment, this.container, this.currentAssignment, this.pendingLocalization, this.startTime, this.pendingDownload, profileActions, pendingStopProfileActions, this.changingBlobs, this.pendingChangingBlobs, this.pendingChangingBlobsAssignment, this.slotMetrics); }
/** * Delete a file or a directory and all of the children. If it exists. * * @param path what to delete * @param user who to delete it as if doing it as someone else is supported * @param logPrefix if an external process needs to be launched to delete the object what prefix to include in the logs * @throws IOException on any error. */ public void deleteIfExists(File path, String user, String logPrefix) throws IOException { //by default no need to do this as a different user deleteIfExists(path); }
/** * Get the total memory used (on and off heap). */ public long getTotalTopologyMemoryUsed() { updateMemoryAccounting(); return containerMemoryTracker.getUsedMemoryMb(_topologyId); }
public static List<String> getDependencyLocationsFor(final Map<String, Object> conf, final String topologyId, final AdvancedFSOps ops, String stormRoot) throws IOException { return TOPO_META_CACHE.get(conf, topologyId, ops, stormRoot).getDepLocs(); }
public static String getStormVersionFor(final Map<String, Object> conf, final String topologyId, final AdvancedFSOps ops, String stormRoot) throws IOException { return TOPO_META_CACHE.get(conf, topologyId, ops, stormRoot).getStormVersion(); }
@Override public Killable recoverContainer(String workerId, LocalState localState) throws IOException { return new RunAsUserContainer(ContainerType.RECOVER_PARTIAL, _conf, _supervisorId, _supervisorPort, -1, null, _resourceIsolationManager, localState, workerId, metricsRegistry, containerMemoryTracker, null, null, null); }
/** * get worker heartbeat by workerId. * * @param conf * @param workerId * @return */ private static LSWorkerHeartbeat readWorkerHeartbeat(Map<String, Object> conf, String workerId) { return _instance.readWorkerHeartbeatImpl(conf, workerId); }
@Override public Container recoverContainer(int port, LocalAssignment assignment, LocalState state) throws IOException { //We are in the same process we cannot recover anything throw new ContainerRecoveryException("Local Mode Recovery is not supported"); }
@Override public void close() throws Exception { SupervisorUtils.resetInstance(); } }
/** * Check if the container is over its memory limit AND needs to be killed. This does not necessarily mean that it just went over the * limit. * * @throws IOException on any error */ public boolean isMemoryLimitViolated(LocalAssignment withUpdatedLimits) throws IOException { updateMemoryAccounting(); return false; }
public synchronized String getStormVersion() throws IOException { if (!_dataCached) { readData(); } return _stormVersion; } }
public DynamicState withChangingBlobs(Set<BlobChanging> changingBlobs) { if (changingBlobs == this.changingBlobs) { return this; } return new DynamicState(this.state, this.newAssignment, this.container, this.currentAssignment, this.pendingLocalization, this.startTime, this.pendingDownload, profileActions, this.pendingStopProfileActions, changingBlobs, this.pendingChangingBlobs, this.pendingChangingBlobsAssignment, this.slotMetrics); }
public DynamicState withCurrentAssignment(final Container container, final LocalAssignment currentAssignment) { return new DynamicState(this.state, this.newAssignment, container, currentAssignment, this.pendingLocalization, this.startTime, this.pendingDownload, this.profileActions, this.pendingStopProfileActions, this.changingBlobs, this.pendingChangingBlobs, this.pendingChangingBlobsAssignment, this.slotMetrics); }
public DynamicState withPendingChangingBlobs(Set<Future<Void>> pendingChangingBlobs, LocalAssignment pendingChangingBlobsAssignment) { return new DynamicState(this.state, this.newAssignment, this.container, this.currentAssignment, this.pendingLocalization, this.startTime, this.pendingDownload, profileActions, this.pendingStopProfileActions, this.changingBlobs, pendingChangingBlobs, pendingChangingBlobsAssignment, this.slotMetrics); } }