YARN-7661. NodeManager metrics return wrong value after update node resource. Contributed by Yang Wang
This commit is contained in:
parent
35ad9b1dd2
commit
811fabdebe
@ -211,7 +211,7 @@ public void completeOpportunisticContainer(Resource res) {
|
||||
|
||||
public void addResource(Resource res) {
|
||||
availableMB = availableMB + res.getMemorySize();
|
||||
availableGB.incr((int)Math.floor(availableMB/1024d));
|
||||
availableGB.set((int)Math.floor(availableMB/1024d));
|
||||
availableVCores.incr(res.getVirtualCores());
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,12 @@ public class TestNodeManagerMetrics {
|
||||
// allocatedGB: 3.75GB allocated memory is shown as 4GB
|
||||
// availableGB: 4.25GB available memory is shown as 4GB
|
||||
checkMetrics(10, 1, 1, 1, 1, 1, 4, 7, 4, 13, 3);
|
||||
|
||||
// Update resource and check available resource again
|
||||
metrics.addResource(total);
|
||||
MetricsRecordBuilder rb = getMetrics("NodeManagerMetrics");
|
||||
assertGauge("AvailableGB", 12, rb);
|
||||
assertGauge("AvailableVCores", 19, rb);
|
||||
}
|
||||
|
||||
private void checkMetrics(int launched, int completed, int failed, int killed,
|
||||
|
Loading…
Reference in New Issue
Block a user