LuciferYang commented on code in PR #36890:
URL: https://github.com/apache/spark/pull/36890#discussion_r900949722
##########
resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala:
##########
@@ -462,6 +463,21 @@ private[yarn] class YarnAllocator(
private def getHostAddress(nodeReport: NodeReport): String =
nodeReport.getNodeId.getHost
+ /**
+ * Checks if node is in DECOMMISSIONING STATE
+ *
+ * Visible for testing.
+ */
+ def isDecommissioningNode(node: NodeReport): Boolean = {
+ // In hadoop-2.7 there is no support for node state DECOMMISSIONING
+ // In Hadoop-2.8, hadoop3.1 and later version of spark there is a support
+ // to node state DECOMMISSIONING.
+ // Inorder to build the spark using hadoop2 and hadoop3, not
+ // using YarnNodeState for the node state DECOMMISSIONING here and
+ // instead comparing Node states on spark end
+ NodeState.getYarnNodeState(node.getNodeState) == NodeState.DECOMMISSIONING
Review Comment:
hmm... Is it really necessary to define `NodeState`?
Is
```
NodeState.getYarnNodeState(node.getNodeState) == NodeState.DECOMMISSIONING
```
equivalent to
```
node.getNodeState.toString.equals("DECOMMISSIONING")
```
?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]