Class TrafficControlBandwidthHandlerImpl
java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.TrafficControlBandwidthHandlerImpl
- All Implemented Interfaces:
OutboundBandwidthResourceHandler,ResourceHandler
@Private
@Unstable
public class TrafficControlBandwidthHandlerImpl
extends Object
implements OutboundBandwidthResourceHandler
-
Constructor Summary
ConstructorsConstructorDescriptionTrafficControlBandwidthHandlerImpl(PrivilegedOperationExecutor privilegedOperationExecutor, CGroupsHandler cGroupsHandler, org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.TrafficController trafficController) -
Method Summary
Modifier and TypeMethodDescriptionbootstrap(org.apache.hadoop.conf.Configuration configuration) Bootstrapping 'outbound-bandwidth' resource handler - mounts net_cls controller and bootstraps a traffic control bandwidth shaping hierarchyReturns total bytes sent per container to be used for metrics tracking purposes.postComplete(org.apache.hadoop.yarn.api.records.ContainerId containerId) Cleanup operations once container is completed - deletes cgroup and removes traffic shaping rule(s).Pre-start hook for 'outbound-bandwidth' resource.reacquireContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId) Reacquires state for a container - reads the classid from the cgroup being used for the container being reacquiredteardown()Teardown environment for resource subsystem if requested.toString()updateContainer(Container container) Update state for container that was already launched
-
Constructor Details
-
TrafficControlBandwidthHandlerImpl
public TrafficControlBandwidthHandlerImpl(PrivilegedOperationExecutor privilegedOperationExecutor, CGroupsHandler cGroupsHandler, org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.TrafficController trafficController)
-
-
Method Details
-
bootstrap
public List<PrivilegedOperation> bootstrap(org.apache.hadoop.conf.Configuration configuration) throws ResourceHandlerException Bootstrapping 'outbound-bandwidth' resource handler - mounts net_cls controller and bootstraps a traffic control bandwidth shaping hierarchy- Specified by:
bootstrapin interfaceResourceHandler- Parameters:
configuration- yarn configuration in use- Returns:
- (potentially empty) list of privileged operations to execute.
- Throws:
ResourceHandlerException
-
preStart
Pre-start hook for 'outbound-bandwidth' resource. A cgroup is created and a net_cls classid is generated and written to a cgroup file. A traffic control shaping rule is created in order to limit outbound bandwidth utilization.- Specified by:
preStartin interfaceResourceHandler- Parameters:
container- Container being launched- Returns:
- privileged operations for some cgroups/tc operations.
- Throws:
ResourceHandlerException
-
reacquireContainer
public List<PrivilegedOperation> reacquireContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws ResourceHandlerException Reacquires state for a container - reads the classid from the cgroup being used for the container being reacquired- Specified by:
reacquireContainerin interfaceResourceHandler- Parameters:
containerId- if of the container being reacquired.- Returns:
- (potentially empty) list of privileged operations
- Throws:
ResourceHandlerException
-
updateContainer
public List<PrivilegedOperation> updateContainer(Container container) throws ResourceHandlerException Description copied from interface:ResourceHandlerUpdate state for container that was already launched- Specified by:
updateContainerin interfaceResourceHandler- Parameters:
container- the container being updated.- Returns:
- (possibly empty) list of operations that require elevated privileges
- Throws:
ResourceHandlerException
-
getBytesSentPerContainer
public Map<org.apache.hadoop.yarn.api.records.ContainerId,Integer> getBytesSentPerContainer() throws ResourceHandlerExceptionReturns total bytes sent per container to be used for metrics tracking purposes.- Returns:
- a map of containerId to bytes sent
- Throws:
ResourceHandlerException
-
postComplete
public List<PrivilegedOperation> postComplete(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws ResourceHandlerException Cleanup operations once container is completed - deletes cgroup and removes traffic shaping rule(s).- Specified by:
postCompletein interfaceResourceHandler- Parameters:
containerId- of the container that was completed.- Returns:
- null
- Throws:
ResourceHandlerException
-
teardown
Description copied from interface:ResourceHandlerTeardown environment for resource subsystem if requested. This method needs to be used with care since it could impact running containers.- Specified by:
teardownin interfaceResourceHandler- Returns:
- (possibly empty) list of operations that require elevated privileges
- Throws:
ResourceHandlerException
-
toString
-