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;
|
||||
}
|
||||
if (resource.equals(ResourceInformation.VCORES_URI)) {
|
||||
this.setVirtualCores((int) resourceInformation.getValue());
|
||||
this.setVirtualCores(castToIntSafely(resourceInformation.getValue()));
|
||||
return;
|
||||
}
|
||||
ResourceInformation storedResourceInfo = getResourceInformation(resource);
|
||||
|
@ -331,7 +331,7 @@ public abstract class Resource implements Comparable<Resource> {
|
|||
return;
|
||||
}
|
||||
if (resource.equals(ResourceInformation.VCORES_URI)) {
|
||||
this.setVirtualCores((int)value);
|
||||
this.setVirtualCores(castToIntSafely(value));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public class LightWeightResource extends Resource {
|
|||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public int getMemory() {
|
||||
return (int) memoryResInfo.getValue();
|
||||
return castToIntSafely(memoryResInfo.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -113,7 +113,7 @@ public class LightWeightResource extends Resource {
|
|||
|
||||
@Override
|
||||
public int getVirtualCores() {
|
||||
return (int) vcoresResInfo.getValue();
|
||||
return castToIntSafely(vcoresResInfo.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -117,7 +117,7 @@ public class ResourcePBImpl extends Resource {
|
|||
@Override
|
||||
public int getVirtualCores() {
|
||||
// vcores should always be present
|
||||
return (int) resources[VCORES_INDEX].getValue();
|
||||
return castToIntSafely(resources[VCORES_INDEX].getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue