YARN-7489. ConcurrentModificationException in RMAppImpl#getRMAppMetrics. Contributed by Tao Yang.
This commit is contained in:
parent
b57ea38fcf
commit
5c2986e58d
|
@ -1616,24 +1616,29 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|||
long vcoreSeconds = 0;
|
||||
long preemptedMemorySeconds = 0;
|
||||
long preemptedVcoreSeconds = 0;
|
||||
for (RMAppAttempt attempt : attempts.values()) {
|
||||
if (null != attempt) {
|
||||
RMAppAttemptMetrics attemptMetrics =
|
||||
attempt.getRMAppAttemptMetrics();
|
||||
Resources.addTo(resourcePreempted,
|
||||
attemptMetrics.getResourcePreempted());
|
||||
numAMContainerPreempted += attemptMetrics.getIsPreempted() ? 1 : 0;
|
||||
numNonAMContainerPreempted +=
|
||||
attemptMetrics.getNumNonAMContainersPreempted();
|
||||
// getAggregateAppResourceUsage() will calculate resource usage stats
|
||||
// for both running and finished containers.
|
||||
AggregateAppResourceUsage resUsage =
|
||||
attempt.getRMAppAttemptMetrics().getAggregateAppResourceUsage();
|
||||
memorySeconds += resUsage.getMemorySeconds();
|
||||
vcoreSeconds += resUsage.getVcoreSeconds();
|
||||
preemptedMemorySeconds += attemptMetrics.getPreemptedMemory();
|
||||
preemptedVcoreSeconds += attemptMetrics.getPreemptedVcore();
|
||||
this.readLock.lock();
|
||||
try {
|
||||
for (RMAppAttempt attempt : attempts.values()) {
|
||||
if (null != attempt) {
|
||||
RMAppAttemptMetrics attemptMetrics =
|
||||
attempt.getRMAppAttemptMetrics();
|
||||
Resources.addTo(resourcePreempted,
|
||||
attemptMetrics.getResourcePreempted());
|
||||
numAMContainerPreempted += attemptMetrics.getIsPreempted() ? 1 : 0;
|
||||
numNonAMContainerPreempted +=
|
||||
attemptMetrics.getNumNonAMContainersPreempted();
|
||||
// getAggregateAppResourceUsage() will calculate resource usage stats
|
||||
// for both running and finished containers.
|
||||
AggregateAppResourceUsage resUsage =
|
||||
attempt.getRMAppAttemptMetrics().getAggregateAppResourceUsage();
|
||||
memorySeconds += resUsage.getMemorySeconds();
|
||||
vcoreSeconds += resUsage.getVcoreSeconds();
|
||||
preemptedMemorySeconds += attemptMetrics.getPreemptedMemory();
|
||||
preemptedVcoreSeconds += attemptMetrics.getPreemptedVcore();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
this.readLock.unlock();
|
||||
}
|
||||
|
||||
return new RMAppMetrics(resourcePreempted,
|
||||
|
|
Loading…
Reference in New Issue