YARN-6935. [YARN-3926] ResourceProfilesManagerImpl.parseResource() has no need of the key parameter
(Contributed by Manikandan R via Daniel Templeton)
This commit is contained in:
parent
3aeaafecb8
commit
5c4ab4c291
@ -87,22 +87,22 @@ private void loadProfiles() throws IOException {
|
|||||||
Iterator iterator = data.entrySet().iterator();
|
Iterator iterator = data.entrySet().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Map.Entry entry = (Map.Entry) iterator.next();
|
Map.Entry entry = (Map.Entry) iterator.next();
|
||||||
String key = entry.getKey().toString();
|
String profileName = entry.getKey().toString();
|
||||||
if (key.isEmpty()) {
|
if (profileName.isEmpty()) {
|
||||||
throw new IOException(
|
throw new IOException(
|
||||||
"Name of resource profile cannot be an empty string");
|
"Name of resource profile cannot be an empty string");
|
||||||
}
|
}
|
||||||
if (entry.getValue() instanceof Map) {
|
if (entry.getValue() instanceof Map) {
|
||||||
Map value = (Map) entry.getValue();
|
Map profileInfo = (Map) entry.getValue();
|
||||||
// ensure memory and vcores are specified
|
// ensure memory and vcores are specified
|
||||||
if (!value.containsKey(MEMORY) || !value.containsKey(VCORES)) {
|
if (!profileInfo.containsKey(MEMORY) || !profileInfo.containsKey(VCORES)) {
|
||||||
throw new IOException(
|
throw new IOException(
|
||||||
"Illegal resource profile definition; profile '" + key
|
"Illegal resource profile definition; profile '" + profileName
|
||||||
+ "' must contain '" + MEMORY + "' and '" + VCORES + "'");
|
+ "' must contain '" + MEMORY + "' and '" + VCORES + "'");
|
||||||
}
|
}
|
||||||
Resource resource = parseResource(key, value);
|
Resource resource = parseResource(profileInfo);
|
||||||
profiles.put(key, resource);
|
profiles.put(profileName, resource);
|
||||||
LOG.info("Added profile '" + key + "' with resources " + resource);
|
LOG.info("Added profile '" + profileName + "' with resources " + resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check to make sure mandatory profiles are present
|
// check to make sure mandatory profiles are present
|
||||||
@ -116,9 +116,9 @@ private void loadProfiles() throws IOException {
|
|||||||
LOG.info("Loaded profiles " + profiles.keySet());
|
LOG.info("Loaded profiles " + profiles.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Resource parseResource(String key, Map value) throws IOException {
|
private Resource parseResource(Map profileInfo) throws IOException {
|
||||||
Resource resource = Resource.newInstance(0, 0);
|
Resource resource = Resource.newInstance(0, 0);
|
||||||
Iterator iterator = value.entrySet().iterator();
|
Iterator iterator = profileInfo.entrySet().iterator();
|
||||||
Map<String, ResourceInformation> resourceTypes = ResourceUtils
|
Map<String, ResourceInformation> resourceTypes = ResourceUtils
|
||||||
.getResourceTypes();
|
.getResourceTypes();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user