Container.ContainerType
Modifier and Type | Field and Description |
---|---|
protected boolean |
exitedEarly |
protected double |
hardMemoryLimitMultiplier |
protected long |
hardMemoryLimitOver |
protected LocalState |
localState |
protected long |
lowMemoryThresholdMb |
protected long |
mediumMemoryGracePeriodMs |
protected long |
mediumMemoryThresholdMb |
protected long |
memoryLimitExceededStart |
protected long |
memoryLimitMb |
protected String |
profileCmd |
protected String |
stormHome |
assignment, conf, containerMemoryTracker, ops, port, resourceIsolationManager, runAsUser, supervisorId, supervisorPort, symlinksDisabled, topoConf, topologyId, type, workerId
Constructor and Description |
---|
BasicContainer(Container.ContainerType type,
Map<String,Object> conf,
String supervisorId,
int supervisorPort,
int port,
LocalAssignment assignment,
ResourceIsolationInterface resourceIsolationManager,
LocalState localState,
String workerId,
StormMetricsRegistry metricsRegistry,
ContainerMemoryTracker containerMemoryTracker)
Create a new BasicContainer.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanUpForRestart()
Clean up the container partly preparing for restart.
|
protected void |
createNewWorkerId()
Create a new worker ID for this process and store in in this object and in the local state.
|
boolean |
didMainProcessExit()
Return true if the main process exited, else false.
|
protected List<String> |
frameworkClasspath(SimpleVersion topoVersion) |
static List<String> |
getDependencyLocationsFor(Map<String,Object> conf,
String topologyId,
AdvancedFSOps ops,
String stormRoot) |
long |
getMemoryReservationMb()
Get the current memory reservation of this container.
|
long |
getMemoryUsageMb()
Get the current memory usage of this container.
|
static String |
getStormVersionFor(Map<String,Object> conf,
String topologyId,
AdvancedFSOps ops,
String stormRoot) |
protected String |
getWildcardDir(File dir)
Returns a path with a wildcard as the final element, so that the JVM will expand that to all JARs in the directory.
|
protected String |
getWorkerClassPath(String stormJar,
List<String> dependencyLocations,
SimpleVersion topoVersion)
Compute the classpath for the worker process.
|
protected String |
getWorkerLogWriter(SimpleVersion topoVersion) |
protected String |
getWorkerMain(SimpleVersion topoVersion) |
boolean |
isMemoryLimitViolated(LocalAssignment withUpdatedLimits)
Check if the container is over its memory limit AND needs to be killed.
|
protected String |
javaCmd(String cmd) |
protected String |
javaLibraryPath(String stormRoot,
Map<String,Object> conf)
Compute the java.library.path that should be used for the worker.
|
void |
launch()
Launch the process for the first time.
|
void |
relaunch()
Restart the processes in this container.
|
boolean |
runProfiling(ProfileRequest request,
boolean stop)
Run a profiling request.
|
protected List<String> |
substituteChildopts(Object value) |
protected List<String> |
substituteChildopts(Object value,
int memOnheap,
int memOffHeap) |
areAllProcessesDead, cleanUp, createArtifactsLink, createBlobstoreLinks, deleteSavedWorkerUser, forceKill, getTotalTopologyMemoryReserved, getTotalTopologyMemoryUsed, getTotalWorkersForThisTopology, getWorkerId, getWorkerUser, kill, readHeartbeat, readTopoConf, saveWorkerUser, setup, toString, updateMemoryAccounting, writeLogMetadata
protected final LocalState localState
protected final String profileCmd
protected final String stormHome
protected final double hardMemoryLimitMultiplier
protected final long hardMemoryLimitOver
protected final long lowMemoryThresholdMb
protected final long mediumMemoryThresholdMb
protected final long mediumMemoryGracePeriodMs
protected volatile boolean exitedEarly
protected volatile long memoryLimitMb
protected volatile long memoryLimitExceededStart
public BasicContainer(Container.ContainerType type, Map<String,Object> conf, String supervisorId, int supervisorPort, int port, LocalAssignment assignment, ResourceIsolationInterface resourceIsolationManager, LocalState localState, String workerId, StormMetricsRegistry metricsRegistry, ContainerMemoryTracker containerMemoryTracker) throws IOException
type
- the type of container being made.conf
- the supervisor configsupervisorId
- the ID of the supervisor this is a part of.supervisorPort
- the thrift server port of the supervisor this is a part of.port
- the port the container is on. Should be <= 0 if only a partial recoveryassignment
- the assignment for this container. Should be null if only a partial recovery.resourceIsolationManager
- used to isolate resources for a container can be null if no isolation is used.localState
- the local state of the supervisor. May be null if partial recoveryworkerId
- the id of the worker to use. Must not be null if doing a partial recovery.metricsRegistry
- The metrics registry.containerMemoryTracker
- The shared memory tracker for the supervisor's containersIOException
public static List<String> getDependencyLocationsFor(Map<String,Object> conf, String topologyId, AdvancedFSOps ops, String stormRoot) throws IOException
IOException
public static String getStormVersionFor(Map<String,Object> conf, String topologyId, AdvancedFSOps ops, String stormRoot) throws IOException
IOException
protected void createNewWorkerId()
public void cleanUpForRestart() throws IOException
Container
cleanUpForRestart
in class Container
IOException
- on any errorpublic void relaunch() throws IOException
Container
relaunch
in class Container
IOException
- on any errorpublic boolean didMainProcessExit()
Container
didMainProcessExit
in class Container
public boolean runProfiling(ProfileRequest request, boolean stop) throws IOException, InterruptedException
Container
runProfiling
in class Container
request
- the request to runstop
- is this a stop request?IOException
- on any errorInterruptedException
- if running the command is interrupted.protected String javaLibraryPath(String stormRoot, Map<String,Object> conf)
stormRoot
- the root directory of the worker processconf
- the config for the supervisor.protected String getWildcardDir(File dir)
dir
- the directory to which a wildcard will be appendedprotected List<String> frameworkClasspath(SimpleVersion topoVersion)
protected String getWorkerMain(SimpleVersion topoVersion)
protected String getWorkerLogWriter(SimpleVersion topoVersion)
protected String getWorkerClassPath(String stormJar, List<String> dependencyLocations, SimpleVersion topoVersion)
stormJar
- the topology jardependencyLocations
- any dependencies from the topologytopoVersion
- the version of the storm framework to useprotected List<String> substituteChildopts(Object value, int memOnheap, int memOffHeap)
public boolean isMemoryLimitViolated(LocalAssignment withUpdatedLimits) throws IOException
Container
isMemoryLimitViolated
in class Container
IOException
- on any errorpublic long getMemoryUsageMb()
Container
getMemoryUsageMb
in class Container
public long getMemoryReservationMb()
Container
getMemoryReservationMb
in class Container
public void launch() throws IOException
Container
launch
in class Container
IOException
- on any errorCopyright © 2023 The Apache Software Foundation. All rights reserved.