[
https://issues.apache.org/jira/browse/YARN-9206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16750094#comment-16750094
]
Kuhu Shukla commented on YARN-9206:
-----------------------------------
Spoke to [~Jim_Brennan] offline and he clarified with the following solution.
It is certainly better but does add some if blocks to the computation, which I
was really trying to not do (at the cost of complexity -which is not ideal).
[~sunilg] please review the following suggestion by [~Jim_Brennan] and if it
looks ok to you I will revise my patch.
{code:java}
public static List<RMNode> queryRMNodes(RMContext context,
EnumSet<NodeState> acceptedStates) {
// nodes contains nodes that are NEW, RUNNING, UNHEALTHY or DECOMMISSIONING.
boolean has_active = false;
boolean has_inactive = false;
ArrayList<RMNode> results = new ArrayList<RMNode>();
for (NodeState nodeState : acceptedStates) {
if (!has_inactive && nodeState.isInactiveState()) {
has_inactive = true;
}
if (!has_active && nodeState.isActiveState()) {
has_active = true;
}
if (has_active && has_inactive) {
break;
}
}
if (has_inactive) {
for (RMNode rmNode : context.getInactiveRMNodes().values()) {
if ((rmNode != null) && acceptedStates.contains(rmNode.getState())) {
results.add(rmNode);
}
}
}
if (has_active) {
for (RMNode rmNode : context.getRMNodes().values()) {
if (acceptedStates.contains(rmNode.getState())) {
results.add(rmNode);
}
}
}
return results;
}
{code}
> RMServerUtils does not count SHUTDOWN as an accepted state
> ----------------------------------------------------------
>
> Key: YARN-9206
> URL: https://issues.apache.org/jira/browse/YARN-9206
> Project: Hadoop YARN
> Issue Type: Bug
> Affects Versions: 3.0.3
> Reporter: Kuhu Shukla
> Assignee: Kuhu Shukla
> Priority: Major
> Attachments: YARN-9206.001.patch, YARN-9206.002.patch,
> YARN-9206.003.patch
>
>
> {code}
> if (acceptedStates.contains(NodeState.DECOMMISSIONED) ||
> acceptedStates.contains(NodeState.LOST) ||
> acceptedStates.contains(NodeState.REBOOTED)) {
> for (RMNode rmNode : context.getInactiveRMNodes().values()) {
> if ((rmNode != null) && acceptedStates.contains(rmNode.getState())) {
> results.add(rmNode);
> }
> }
> }
> return results;
> }
> {code}
> This should include SHUTDOWN state as they are inactive too. This method is
> used for node reports and such so might be useful to account for them as well.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]