Package org.apache.storm.container.oci
Class RuncLibContainerManager
java.lang.Object
org.apache.storm.container.oci.OciContainerManager
org.apache.storm.container.oci.RuncLibContainerManager
- All Implemented Interfaces:
- ResourceIsolationInterface
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.storm.container.oci.OciContainerManagerOciContainerManager.CmdType
- 
Field SummaryFields inherited from class org.apache.storm.container.oci.OciContainerManagercgroupParent, cgroupRootPath, conf, memoryCgroupRootPath, memoryCoreAtRoot, nscdPath, readonlyBindmounts, readwriteBindmounts, seccompJsonFile, stormHome, TMP_DIR, validatedNumaMap, workerToCores, workerToCpu, workerToMemoryMb, workerToMemoryZone
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanareAllProcessesDead(String user, String workerId) The container terminates if any process inside the container dies.voidThis function will be called when the worker needs to shutdown.voidKill the given worker forcefully.longgetMemoryUsage(String user, String workerId, int port) Get the current memory usage of the a given worker.booleanReturn true if resources are being managed.voidKill the given worker.voidlaunchWorkerProcess(String user, String topologyId, Map<String, Object> topoConf, int port, String workerId, List<String> command, Map<String, String> env, String logPrefix, ExitCodeCallback processExitCallback, File targetDir) After reserving resources for the worker (i.e.voidCalled when starting up.booleanrunProfilingCommand(String user, String workerId, List<String> command, Map<String, String> env, String logPrefix, File targetDir) Run profiling command in the container.Methods inherited from class org.apache.storm.container.oci.OciContainerManagercommandFilePath, getImageName, getSystemFreeMemoryMb, reserveResourcesForWorker, writeToCommandFile
- 
Constructor Details- 
RuncLibContainerManagerpublic RuncLibContainerManager()
 
- 
- 
Method Details- 
prepareDescription copied from interface:ResourceIsolationInterfaceCalled when starting up.- Specified by:
- preparein interface- ResourceIsolationInterface
- Overrides:
- preparein class- OciContainerManager
- Parameters:
- conf- the cluster config
- Throws:
- IOException- on any error.
 
- 
launchWorkerProcesspublic void launchWorkerProcess(String user, String topologyId, Map<String, Object> topoConf, int port, String workerId, List<String> command, Map<String, throws IOExceptionString> env, String logPrefix, ExitCodeCallback processExitCallback, File targetDir) Description copied from interface:ResourceIsolationInterfaceAfter reserving resources for the worker (i.e. calling reserveResourcesForWorker), this function can be used to launch worker process.- Parameters:
- user- the user who runs the command as
- topologyId- the Id of the topology
- topoConf- the topology configuration
- port- the port where the worker is on
- workerId- the Id of the worker
- command- the command to run
- env- the environment to run the command
- logPrefix- the prefix to include in the logs
- processExitCallback- a callback for when the process exits
- targetDir- the working directory to run the command in
- Throws:
- IOException- on I/O exception
 
- 
getMemoryUsageDescription copied from interface:ResourceIsolationInterfaceGet the current memory usage of the a given worker.- Parameters:
- user- the user that the worker is running as
- workerId- the id of the worker
- port- the port of the worker
- Returns:
- the amount of memory the worker is using in bytes or -1 if not supported
- Throws:
- IOException- on I/O exception
 
- 
killDescription copied from interface:ResourceIsolationInterfaceKill the given worker.- Parameters:
- user- the user that the worker is running as
- workerId- the id of the worker to kill
- Throws:
- IOException- on I/O exception
 
- 
forceKillDescription copied from interface:ResourceIsolationInterfaceKill the given worker forcefully.- Parameters:
- user- the user that the worker is running as
- workerId- the id of the worker to kill
- Throws:
- IOException- on I/O exception
 
- 
areAllProcessesDeadThe container terminates if any process inside the container dies. So we only need to check if the initial process is alive or not.- Parameters:
- user- the user that the processes are running as
- workerId- the id of the worker to kill
- Returns:
- true if all processes are dead; false otherwise
- Throws:
- IOException- on I/O exception
 
- 
cleanupDescription copied from interface:ResourceIsolationInterfaceThis function will be called when the worker needs to shutdown. This function should include logic to clean up after a worker is shutdown.- Specified by:
- cleanupin interface- ResourceIsolationInterface
- Overrides:
- cleanupin class- OciContainerManager
- Parameters:
- user- the user of the worker
- workerId- worker id to shutdown and clean up after
- port- the port of the worker
- Throws:
- IOException
 
- 
runProfilingCommandpublic boolean runProfilingCommand(String user, String workerId, List<String> command, Map<String, String> env, String logPrefix, File targetDir) throws IOException, InterruptedExceptionRun profiling command in the container.- Parameters:
- user- the user that the worker is running as
- workerId- the id of the worker
- command- the command to run. The profiler to be used is configured in worker-launcher.cfg.
- env- the environment to run the command
- logPrefix- the prefix to include in the logs
- targetDir- the working directory to run the command in
- Returns:
- true if the command succeeds, false otherwise.
- Throws:
- IOException- on I/O exception
- InterruptedException- if interrupted
 
- 
isResourceManagedpublic boolean isResourceManaged()Description copied from interface:ResourceIsolationInterfaceReturn true if resources are being managed. TheDefaultResourceIsolationManagerwill have it return false since it doesn't really manage resources.- Returns:
- true if resources are being managed.
 
 
-