public class AllocationBasedResourceUtilizationTracker extends Object implements ResourceUtilizationTracker
ResourceUtilizationTracker
that equates
resource utilization with the total resource allocated to the container.Modifier and Type | Method and Description |
---|---|
void |
addContainerResources(Container container)
Add Container's resources to the accumulated Utilization.
|
ContainersMonitor |
getContainersMonitor() |
org.apache.hadoop.yarn.api.records.ResourceUtilization |
getCurrentUtilization()
Get the accumulation of totally allocated resources to a container.
|
boolean |
hasEnoughCpu(float currentAllocation,
long totalCores,
int coresRequested)
Returns whether there is enough space for coresRequested in totalCores.
|
boolean |
hasResourcesAvailable(Container container)
Check if NM has resources available currently to run the container.
|
void |
subtractContainerResource(Container container)
Subtract Container's resources to the accumulated Utilization.
|
public org.apache.hadoop.yarn.api.records.ResourceUtilization getCurrentUtilization()
getCurrentUtilization
in interface ResourceUtilizationTracker
public void addContainerResources(Container container)
addContainerResources
in interface ResourceUtilizationTracker
container
- Container.public void subtractContainerResource(Container container)
subtractContainerResource
in interface ResourceUtilizationTracker
container
- Container.public boolean hasResourcesAvailable(Container container)
hasResourcesAvailable
in interface ResourceUtilizationTracker
container
- Container.public boolean hasEnoughCpu(float currentAllocation, long totalCores, int coresRequested)
currentAllocation
- The current allocation, a float value from 0 to 1.totalCores
- The total cores in the system.coresRequested
- The number of cores requested.public ContainersMonitor getContainersMonitor()
Copyright © 2018 Apache Software Foundation. All Rights Reserved.