YARN-4256. YARN fair scheduler vcores with decimal values. Contributed by Jun Gong
This commit is contained in:
parent
47641fcbc9
commit
960201b79b
|
@ -975,6 +975,8 @@ Release 2.8.0 - UNRELEASED
|
||||||
YARN-4270. Limit application resource reservation on nodes for non-node/rack
|
YARN-4270. Limit application resource reservation on nodes for non-node/rack
|
||||||
specific requests (asuresh)
|
specific requests (asuresh)
|
||||||
|
|
||||||
|
YARN-4256. YARN fair scheduler vcores with decimal values. (Jun Gong via zxu)
|
||||||
|
|
||||||
Release 2.7.2 - UNRELEASED
|
Release 2.7.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -283,7 +283,7 @@ public class FairSchedulerConfiguration extends Configuration {
|
||||||
|
|
||||||
private static int findResource(String val, String units)
|
private static int findResource(String val, String units)
|
||||||
throws AllocationConfigurationException {
|
throws AllocationConfigurationException {
|
||||||
Pattern pattern = Pattern.compile("(\\d+)\\s*" + units);
|
Pattern pattern = Pattern.compile("(\\d+)(\\.\\d*)?\\s*" + units);
|
||||||
Matcher matcher = pattern.matcher(val);
|
Matcher matcher = pattern.matcher(val);
|
||||||
if (!matcher.find()) {
|
if (!matcher.find()) {
|
||||||
throw new AllocationConfigurationException("Missing resource: " + units);
|
throw new AllocationConfigurationException("Missing resource: " + units);
|
||||||
|
|
|
@ -45,6 +45,10 @@ public class TestFairSchedulerConfiguration {
|
||||||
parseResourceConfigValue("1024 Mb, 2 vCores"));
|
parseResourceConfigValue("1024 Mb, 2 vCores"));
|
||||||
assertEquals(BuilderUtils.newResource(1024, 2),
|
assertEquals(BuilderUtils.newResource(1024, 2),
|
||||||
parseResourceConfigValue(" 1024 mb, 2 vcores "));
|
parseResourceConfigValue(" 1024 mb, 2 vcores "));
|
||||||
|
assertEquals(BuilderUtils.newResource(1024, 2),
|
||||||
|
parseResourceConfigValue(" 1024.3 mb, 2.35 vcores "));
|
||||||
|
assertEquals(BuilderUtils.newResource(1024, 2),
|
||||||
|
parseResourceConfigValue(" 1024. mb, 2. vcores "));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = AllocationConfigurationException.class)
|
@Test(expected = AllocationConfigurationException.class)
|
||||||
|
|
Loading…
Reference in New Issue