mirror of
https://github.com/wassname/ray.git
synced 2026-07-02 20:47:56 +08:00
Add hostname to nodeinfo(#6156)
This commit is contained in:
@@ -12,14 +12,17 @@ public class NodeInfo {
|
||||
|
||||
public final String nodeAddress;
|
||||
|
||||
public final String nodeHostname;
|
||||
|
||||
public final boolean isAlive;
|
||||
|
||||
public final Map<String, Double> resources;
|
||||
|
||||
public NodeInfo(UniqueId nodeId, String nodeAddress,
|
||||
public NodeInfo(UniqueId nodeId, String nodeAddress, String nodeHostname,
|
||||
boolean isAlive, Map<String, Double> resources) {
|
||||
this.nodeId = nodeId;
|
||||
this.nodeAddress = nodeAddress;
|
||||
this.nodeHostname = nodeHostname;
|
||||
this.isAlive = isAlive;
|
||||
this.resources = resources;
|
||||
}
|
||||
@@ -28,6 +31,7 @@ public class NodeInfo {
|
||||
return "NodeInfo{"
|
||||
+ "nodeId='" + nodeId + '\''
|
||||
+ ", nodeAddress='" + nodeAddress + "\'"
|
||||
+ ", nodeHostname'" + nodeHostname + "\'"
|
||||
+ ", isAlive=" + isAlive
|
||||
+ ", resources=" + resources
|
||||
+ "}";
|
||||
|
||||
@@ -77,12 +77,14 @@ public class GcsClient {
|
||||
if (data.getState() == GcsNodeInfo.GcsNodeState.ALIVE) {
|
||||
//Code path of node insertion.
|
||||
NodeInfo nodeInfo = new NodeInfo(
|
||||
nodeId, data.getNodeManagerAddress(), true, new HashMap<>());
|
||||
nodeId, data.getNodeManagerAddress(),
|
||||
data.getNodeManagerHostname(),
|
||||
true, new HashMap<>());
|
||||
nodes.put(nodeId, nodeInfo);
|
||||
} else {
|
||||
// Code path of node deletion.
|
||||
NodeInfo nodeInfo = new NodeInfo(nodeId, nodes.get(nodeId).nodeAddress,
|
||||
false, new HashMap<>());
|
||||
nodes.get(nodeId).nodeHostname, false, new HashMap<>());
|
||||
nodes.put(nodeId, nodeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user