YARN-3179. Update use of Iterator to Iterable in RMAdminCLI and

CommonNodeLabelsManager. Contributed by Ray Chiang
This commit is contained in:
Xuan 2015-02-12 17:31:45 -08:00
parent 99f6bd4f7a
commit 2586915bb3
3 changed files with 15 additions and 11 deletions

View File

@ -287,6 +287,9 @@ Release 2.7.0 - UNRELEASED
YARN-3158. Correct log messages in ResourceTrackerService. YARN-3158. Correct log messages in ResourceTrackerService.
(Varun Saxena via xgong) (Varun Saxena via xgong)
YARN-3179. Update use of Iterator to Iterable in RMAdminCLI and
CommonNodeLabelsManager. (Ray Chiang via xgong)
OPTIMIZATIONS OPTIMIZATIONS
YARN-2990. FairScheduler's delay-scheduling always waits for node-local and YARN-2990. FairScheduler's delay-scheduling always waits for node-local and

View File

@ -128,12 +128,12 @@ public RMAdminCLI(Configuration conf) {
} }
private static void appendHAUsage(final StringBuilder usageBuilder) { private static void appendHAUsage(final StringBuilder usageBuilder) {
for (String cmdKey : USAGE.keySet()) { for (Map.Entry<String,UsageInfo> cmdEntry : USAGE.entrySet()) {
if (cmdKey.equals("-help")) { if (cmdEntry.getKey().equals("-help")) {
continue; continue;
} }
UsageInfo usageInfo = USAGE.get(cmdKey); UsageInfo usageInfo = cmdEntry.getValue();
usageBuilder.append(" [" + cmdKey + " " + usageInfo.args + "]"); usageBuilder.append(" [" + cmdEntry.getKey() + " " + usageInfo.args + "]");
} }
} }
@ -173,14 +173,15 @@ private static void buildIndividualUsageMsg(String cmd,
private static void buildUsageMsg(StringBuilder builder, private static void buildUsageMsg(StringBuilder builder,
boolean isHAEnabled) { boolean isHAEnabled) {
builder.append("Usage: yarn rmadmin\n"); builder.append("Usage: yarn rmadmin\n");
for (String cmdKey : ADMIN_USAGE.keySet()) { for (Map.Entry<String,UsageInfo> cmdEntry : ADMIN_USAGE.entrySet()) {
UsageInfo usageInfo = ADMIN_USAGE.get(cmdKey); UsageInfo usageInfo = cmdEntry.getValue();
builder.append(" " + cmdKey + " " + usageInfo.args + "\n"); builder.append(" " + cmdEntry.getKey() + " " + usageInfo.args + "\n");
} }
if (isHAEnabled) { if (isHAEnabled) {
for (String cmdKey : USAGE.keySet()) { for (Map.Entry<String,UsageInfo> cmdEntry : USAGE.entrySet()) {
String cmdKey = cmdEntry.getKey();
if (!cmdKey.equals("-help")) { if (!cmdKey.equals("-help")) {
UsageInfo usageInfo = USAGE.get(cmdKey); UsageInfo usageInfo = cmdEntry.getValue();
builder.append(" " + cmdKey + " " + usageInfo.args + "\n"); builder.append(" " + cmdKey + " " + usageInfo.args + "\n");
} }
} }

View File

@ -383,8 +383,8 @@ protected void checkRemoveFromClusterNodeLabels(
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected void internalRemoveFromClusterNodeLabels(Collection<String> labelsToRemove) { protected void internalRemoveFromClusterNodeLabels(Collection<String> labelsToRemove) {
// remove labels from nodes // remove labels from nodes
for (String nodeName : nodeCollections.keySet()) { for (Map.Entry<String,Host> nodeEntry : nodeCollections.entrySet()) {
Host host = nodeCollections.get(nodeName); Host host = nodeEntry.getValue();
if (null != host) { if (null != host) {
host.labels.removeAll(labelsToRemove); host.labels.removeAll(labelsToRemove);
for (Node nm : host.nms.values()) { for (Node nm : host.nms.values()) {