Show connected cluster nodes in analyze page right panel, displaying hostname,...

Show connected cluster nodes in analyze page right panel, displaying hostname, IP, GPU status, weight, and last seen time
parent cd25aa5c
...@@ -91,6 +91,18 @@ ...@@ -91,6 +91,18 @@
html += `<p>Connected clients: ${data.cluster_clients}</p>`; html += `<p>Connected clients: ${data.cluster_clients}</p>`;
html += `<p>Active processes: ${data.active_processes || 0}</p>`; html += `<p>Active processes: ${data.active_processes || 0}</p>`;
html += `<p>GPU-enabled clients: ${data.gpu_clients || 0}</p>`; html += `<p>GPU-enabled clients: ${data.gpu_clients || 0}</p>`;
// Connected nodes
if (data.connected_nodes && data.connected_nodes.length > 0) {
html += '<h5>Connected Nodes:</h5>';
html += '<ul>';
data.connected_nodes.forEach(node => {
const gpuStatus = node.gpu_available ? 'GPU' : 'CPU';
const lastSeen = new Date(node.last_seen * 1000).toLocaleString();
html += `<li><strong>${node.hostname}</strong> (${node.ip_address}) - ${gpuStatus} - Weight: ${node.weight} - Last seen: ${lastSeen}</li>`;
});
html += '</ul>';
}
} }
document.getElementById('stats').innerHTML = html; document.getElementById('stats').innerHTML = html;
......
...@@ -92,7 +92,19 @@ def api_stats(): ...@@ -92,7 +92,19 @@ def api_stats():
data['cluster_clients'] = len(cluster_master.clients) data['cluster_clients'] = len(cluster_master.clients)
data['active_processes'] = len(cluster_master.processes) data['active_processes'] = len(cluster_master.processes)
data['gpu_clients'] = sum(1 for c in cluster_master.clients.values() data['gpu_clients'] = sum(1 for c in cluster_master.clients.values()
if c['gpu_info'].get('cuda_available') or c['gpu_info'].get('rocm_available')) if c['gpu_info'].get('cuda_available') or c['gpu_info'].get('rocm_available'))
# Add connected nodes details
data['connected_nodes'] = []
for client_id, client_info in cluster_master.clients.items():
data['connected_nodes'].append({
'client_id': client_id,
'hostname': client_info.get('hostname', 'unknown'),
'ip_address': client_info.get('ip_address', 'unknown'),
'weight': client_info.get('weight', 0),
'gpu_available': client_info['gpu_info'].get('cuda_available') or client_info['gpu_info'].get('rocm_available'),
'backends': client_info.get('available_backends', []),
'last_seen': client_info.get('last_seen', 0)
})
except: except:
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment