YARN-786: Addendum so that RMAppAttemptImpl#getApplicationResourceUsageReport won't return null
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1543597 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d9ba056bdb
commit
c78c0e277f
|
@ -53,6 +53,7 @@ import org.apache.hadoop.yarn.api.records.ContainerStatus;
|
||||||
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
|
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeId;
|
import org.apache.hadoop.yarn.api.records.NodeId;
|
||||||
import org.apache.hadoop.yarn.api.records.Priority;
|
import org.apache.hadoop.yarn.api.records.Priority;
|
||||||
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
import org.apache.hadoop.yarn.api.records.ResourceRequest;
|
import org.apache.hadoop.yarn.api.records.ResourceRequest;
|
||||||
import org.apache.hadoop.yarn.event.EventHandler;
|
import org.apache.hadoop.yarn.event.EventHandler;
|
||||||
import org.apache.hadoop.yarn.factories.RecordFactory;
|
import org.apache.hadoop.yarn.factories.RecordFactory;
|
||||||
|
@ -653,7 +654,14 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
|
||||||
public ApplicationResourceUsageReport getApplicationResourceUsageReport() {
|
public ApplicationResourceUsageReport getApplicationResourceUsageReport() {
|
||||||
this.readLock.lock();
|
this.readLock.lock();
|
||||||
try {
|
try {
|
||||||
return scheduler.getAppResourceUsageReport(this.getAppAttemptId());
|
ApplicationResourceUsageReport report =
|
||||||
|
scheduler.getAppResourceUsageReport(this.getAppAttemptId());
|
||||||
|
if (report == null) {
|
||||||
|
Resource none = Resource.newInstance(0, 0);
|
||||||
|
report = ApplicationResourceUsageReport.newInstance(0, 0, none, none,
|
||||||
|
none);
|
||||||
|
}
|
||||||
|
return report;
|
||||||
} finally {
|
} finally {
|
||||||
this.readLock.unlock();
|
this.readLock.unlock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue