Package org.apache.storm.container.oci
Class OciContainerManager
- java.lang.Object
-
- org.apache.storm.container.oci.OciContainerManager
-
- All Implemented Interfaces:
ResourceIsolationInterface
- Direct Known Subclasses:
DockerManager,RuncLibContainerManager
public abstract class OciContainerManager extends Object implements ResourceIsolationInterface
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classOciContainerManager.CmdType
-
Field Summary
Fields Modifier and Type Field Description protected StringcgroupParentprotected StringcgroupRootPathprotected Map<String,Object>confprotected StringmemoryCgroupRootPathprotected MemoryCorememoryCoreAtRootprotected StringnscdPathprotected List<String>readonlyBindmountsprotected List<String>readwriteBindmountsprotected StringseccompJsonFileprotected StringstormHomeprotected static StringTMP_DIRprotected Map<String,Object>validatedNumaMapprotected Map<String,List<String>>workerToCoresprotected Map<String,Integer>workerToCpuprotected Map<String,Integer>workerToMemoryMbprotected Map<String,String>workerToMemoryZone
-
Constructor Summary
Constructors Constructor Description OciContainerManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup(String user, String workerId, int port)This function will be called when the worker needs to shutdown.protected StringcommandFilePath(String dir, String commandTag)protected StringgetImageName(Map<String,Object> topoConf)Get image name from topology Conf.longgetSystemFreeMemoryMb()Get the amount of free memory in MB.voidprepare(Map<String,Object> conf)Called when starting up.voidreserveResourcesForWorker(String workerId, Integer workerMemoryMb, Integer workerCpu, String numaId)This function should be used prior to starting the worker to reserve resources for the worker.protected StringwriteToCommandFile(String workerDir, String command, String commandTag)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.storm.container.ResourceIsolationInterface
areAllProcessesDead, forceKill, getMemoryUsage, isResourceManaged, kill, launchWorkerProcess, runProfilingCommand
-
-
-
-
Field Detail
-
seccompJsonFile
protected String seccompJsonFile
-
nscdPath
protected String nscdPath
-
TMP_DIR
protected static final String TMP_DIR
-
stormHome
protected String stormHome
-
cgroupRootPath
protected String cgroupRootPath
-
cgroupParent
protected String cgroupParent
-
memoryCgroupRootPath
protected String memoryCgroupRootPath
-
memoryCoreAtRoot
protected MemoryCore memoryCoreAtRoot
-
-
Method Detail
-
prepare
public void prepare(Map<String,Object> conf) throws IOException
Description copied from interface:ResourceIsolationInterfaceCalled when starting up.- Specified by:
preparein interfaceResourceIsolationInterface- Parameters:
conf- the cluster config- Throws:
IOException- on any error.
-
reserveResourcesForWorker
public void reserveResourcesForWorker(String workerId, Integer workerMemoryMb, Integer workerCpu, String numaId)
Description copied from interface:ResourceIsolationInterfaceThis function should be used prior to starting the worker to reserve resources for the worker.- Specified by:
reserveResourcesForWorkerin interfaceResourceIsolationInterface- Parameters:
workerId- worker id of the worker to startworkerMemoryMb- the amount of memory for the worker or null if not enforcedworkerCpu- the amount of cpu for the worker or null if not enforcednumaId- NUMA zone if applicable the worker should be bound to
-
cleanup
public void cleanup(String user, String workerId, int port) throws IOException
Description 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 interfaceResourceIsolationInterface- Parameters:
user- the user of the workerworkerId- worker id to shutdown and clean up afterport- the port of the worker- Throws:
IOException
-
getSystemFreeMemoryMb
public long getSystemFreeMemoryMb() throws IOExceptionDescription copied from interface:ResourceIsolationInterfaceGet the amount of free memory in MB. This might not be the entire box, it might be within a parent resource group.- Specified by:
getSystemFreeMemoryMbin interfaceResourceIsolationInterface- Returns:
- The amount of memory in MB that are free on the system.
- Throws:
IOException- on I/O exception
-
getImageName
protected String getImageName(Map<String,Object> topoConf)
Get image name from topology Conf.- Parameters:
topoConf- topology configuration- Returns:
- the image name
-
writeToCommandFile
protected String writeToCommandFile(String workerDir, String command, String commandTag) throws IOException
- Throws:
IOException
-
-