YARN-9175. Null resources check in ResourceInfo for branch-3.0
(cherry picked from commit a0291a015c
)
This commit is contained in:
parent
4d30c90a1b
commit
078dfb09fe
|
@ -62,7 +62,7 @@ public class ResourceInfo {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return resources.toString();
|
return getResource().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMemory(int memory) {
|
public void setMemory(int memory) {
|
||||||
|
@ -82,6 +82,9 @@ public class ResourceInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Resource getResource() {
|
public Resource getResource() {
|
||||||
|
if (resources == null) {
|
||||||
|
resources = Resource.newInstance(memory, vCores);
|
||||||
|
}
|
||||||
return Resource.newInstance(resources);
|
return Resource.newInstance(resources);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue