public class CGroupsManager extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
CGroupsManager.NodeProcessInfo |
| Constructor and Description |
|---|
CGroupsManager(String cgroupUtilsDir,
String cgroupBaseDir,
String cgroupSubsystems,
org.apache.uima.ducc.common.utils.DuccLogger agentLogger) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cgroupExists(String cgroup) |
void |
cleanupOnStartup()
Finds all stale CGroups in /cgroup/ducc folder and cleans them
up.
|
Set<String> |
collectExistingContainers()
Return a Set of existing cgroup Ids found in the filesystem identified by
'cgroupBaseDir'.
|
boolean |
createContainer(String containerId,
String userId,
boolean useDuccSpawn)
Creates cgroup container with a given id and owner.
|
boolean |
destroyContainer(String containerId)
Removes cgroup container with a given id.
|
String[] |
getAllCGroupPids()
Returns an array of PIDs managed by cgroups.
|
String |
getCGroupsUtilsDir() |
String |
getContainerId(ManagedProcess managedProcess) |
String |
getDuccCGroupBaseDir() |
String[] |
getPidsInCgroup(String cgroupName) |
Set<CGroupsManager.NodeProcessInfo> |
getProcessesOnNode() |
String |
getSubsystems() |
boolean |
isPidInCGroup(String pid) |
void |
kill(String user,
String pid) |
static void |
main(String[] args) |
boolean |
setContainerCpuShares(String containerId,
String userId,
boolean useDuccSpawn,
long containerCpuShares)
Sets the cpu shares use for an existing cgroup container.
|
boolean |
setContainerMaxMemoryLimit(String containerId,
String userId,
boolean useDuccSpawn,
long containerMaxSize)
Sets the max memory use for an existing cgroup container.
|
public static void main(String[] args)
args - public String getCGroupsUtilsDir()
public String[] getPidsInCgroup(String cgroupName) throws Exception
Exceptionpublic void cleanupOnStartup()
throws Exception
Exceptionpublic String[] getAllCGroupPids() throws Exception
Exceptionpublic String getContainerId(ManagedProcess managedProcess)
public boolean createContainer(String containerId, String userId, boolean useDuccSpawn) throws Exception
containerId - - new cgroup container iduserId - - owner of the cgroup containeruseDuccSpawn - - use duccling to run 'cgcreate' commandExceptionpublic boolean setContainerMaxMemoryLimit(String containerId, String userId, boolean useDuccSpawn, long containerMaxSize) throws Exception
containerId - - existing container id for which limit will be setuserId - - container owneruseDuccSpawn - - run 'cgset' command as a usercontainerMaxSize - - max memory limitExceptionpublic boolean setContainerCpuShares(String containerId, String userId, boolean useDuccSpawn, long containerCpuShares) throws Exception
containerId - - existing container id for which limit will be setuserId - - container owneruseDuccSpawn - - run 'cgset' command as a usercontainerCpuShares - - cpu sharesExceptionpublic boolean destroyContainer(String containerId) throws Exception
containerId - - cgroup to removeExceptionpublic Set<String> collectExistingContainers() throws Exception
Exceptionpublic String getDuccCGroupBaseDir()
public String getSubsystems()
public Set<CGroupsManager.NodeProcessInfo> getProcessesOnNode() throws Exception
ExceptionCopyright © 2012–2015 The Apache Software Foundation. All rights reserved.