You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by su...@apache.org on 2019/02/07 13:46:02 UTC
[hadoop] branch branch-2.8 updated: YARN-9206. RMServerUtils does
not count SHUTDOWN as an accepted state. Contributed by Kuhu Shukla.
This is an automated email from the ASF dual-hosted git repository.
sunilg pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-2.8 by this push:
new 4c063fa YARN-9206. RMServerUtils does not count SHUTDOWN as an accepted state. Contributed by Kuhu Shukla.
4c063fa is described below
commit 4c063fa293c4f0bddcb47d157a7195c479d127bf
Author: Sunil G <su...@apache.org>
AuthorDate: Thu Feb 7 19:15:48 2019 +0530
YARN-9206. RMServerUtils does not count SHUTDOWN as an accepted state. Contributed by Kuhu Shukla.
---
.../apache/hadoop/yarn/api/records/NodeState.java | 12 ++++++++++++
.../yarn/server/resourcemanager/RMServerUtils.java | 22 +++++++++++++++-------
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeState.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeState.java
index d0344fb..2700cf2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeState.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeState.java
@@ -55,4 +55,16 @@ public enum NodeState {
return (this == UNHEALTHY || this == DECOMMISSIONED
|| this == LOST || this == SHUTDOWN);
}
+
+ public boolean isInactiveState() {
+ return this == NodeState.DECOMMISSIONED ||
+ this == NodeState.LOST || this == NodeState.REBOOTED ||
+ this == NodeState.SHUTDOWN;
+ }
+
+ public boolean isActiveState() {
+ return this == NodeState.NEW ||
+ this == NodeState.RUNNING || this == NodeState.UNHEALTHY ||
+ this == NodeState.DECOMMISSIONING;
+ }
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMServerUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMServerUtils.java
index 14416c7..d355837 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMServerUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMServerUtils.java
@@ -91,10 +91,20 @@ public class RMServerUtils {
EnumSet<NodeState> acceptedStates) {
// nodes contains nodes that are NEW, RUNNING OR UNHEALTHY
ArrayList<RMNode> results = new ArrayList<RMNode>();
- if (acceptedStates.contains(NodeState.NEW) ||
- acceptedStates.contains(NodeState.RUNNING) ||
- acceptedStates.contains(NodeState.DECOMMISSIONING) ||
- acceptedStates.contains(NodeState.UNHEALTHY)) {
+ boolean hasActive = false;
+ boolean hasInactive = false;
+ for (NodeState nodeState : acceptedStates) {
+ if (!hasInactive && nodeState.isInactiveState()) {
+ hasInactive = true;
+ }
+ if (!hasActive && nodeState.isActiveState()) {
+ hasActive = true;
+ }
+ if (hasActive && hasInactive) {
+ break;
+ }
+ }
+ if (hasActive) {
for (RMNode rmNode : context.getRMNodes().values()) {
if (acceptedStates.contains(rmNode.getState())) {
results.add(rmNode);
@@ -103,9 +113,7 @@ public class RMServerUtils {
}
// inactiveNodes contains nodes that are DECOMMISSIONED, LOST, OR REBOOTED
- if (acceptedStates.contains(NodeState.DECOMMISSIONED) ||
- acceptedStates.contains(NodeState.LOST) ||
- acceptedStates.contains(NodeState.REBOOTED)) {
+ if (hasInactive) {
for (RMNode rmNode : context.getInactiveRMNodes().values()) {
if ((rmNode != null) && acceptedStates.contains(rmNode.getState())) {
results.add(rmNode);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org