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 ResourceUtilizationTrackerpublic void addContainerResources(Container container)
addContainerResources in interface ResourceUtilizationTrackercontainer - Container.public void subtractContainerResource(Container container)
subtractContainerResource in interface ResourceUtilizationTrackercontainer - Container.public boolean hasResourcesAvailable(Container container)
hasResourcesAvailable in interface ResourceUtilizationTrackercontainer - 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 © 2022 Apache Software Foundation. All rights reserved.