YARN-7270 addendum: Reapplied changes after YARN-3926 backports
This commit is contained in:
parent
0f7786cee3
commit
0bc3c9fca2
|
@ -285,7 +285,7 @@ public abstract class Resource implements Comparable<Resource> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (resource.equals(ResourceInformation.VCORES_URI)) {
|
if (resource.equals(ResourceInformation.VCORES_URI)) {
|
||||||
this.setVirtualCores((int) resourceInformation.getValue());
|
this.setVirtualCores(castToIntSafely(resourceInformation.getValue()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ResourceInformation storedResourceInfo = getResourceInformation(resource);
|
ResourceInformation storedResourceInfo = getResourceInformation(resource);
|
||||||
|
@ -331,7 +331,7 @@ public abstract class Resource implements Comparable<Resource> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (resource.equals(ResourceInformation.VCORES_URI)) {
|
if (resource.equals(ResourceInformation.VCORES_URI)) {
|
||||||
this.setVirtualCores((int)value);
|
this.setVirtualCores(castToIntSafely(value));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class LightWeightResource extends Resource {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public int getMemory() {
|
public int getMemory() {
|
||||||
return (int) memoryResInfo.getValue();
|
return castToIntSafely(memoryResInfo.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -113,7 +113,7 @@ public class LightWeightResource extends Resource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getVirtualCores() {
|
public int getVirtualCores() {
|
||||||
return (int) vcoresResInfo.getValue();
|
return castToIntSafely(vcoresResInfo.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class ResourcePBImpl extends Resource {
|
||||||
@Override
|
@Override
|
||||||
public int getVirtualCores() {
|
public int getVirtualCores() {
|
||||||
// vcores should always be present
|
// vcores should always be present
|
||||||
return (int) resources[VCORES_INDEX].getValue();
|
return castToIntSafely(resources[VCORES_INDEX].getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue