(topo: &TopologyResponse, width: usize)
| 498 | } |
| 499 | |
| 500 | fn build_cluster_lines(topo: &TopologyResponse, width: usize) -> Vec<Line<'static>> { |
| 501 | let mut lines: Vec<Line<'static>> = Vec::new(); |
| 502 | |
| 503 | // Collect all nodes for VRAM bar scaling |
| 504 | let all_vram: Vec<u64> = std::iter::once(topo.master.vram_bytes) |
| 505 | .chain(topo.workers.iter().map(|w| w.vram_bytes)) |
| 506 | .collect(); |
| 507 | let max_vram = all_vram.iter().copied().max().unwrap_or(1).max(1); |
| 508 | let bar_max_width = width.saturating_sub(30).min(40); |
| 509 | |
| 510 | // ── Model info ── |
| 511 | lines.push(Line::from("")); |
| 512 | lines.push(Line::from(vec![ |
| 513 | Span::styled(" Model: ", Style::default().fg(Color::DarkGray)), |
| 514 | Span::styled( |
| 515 | topo.model_id.clone(), |
| 516 | Style::default() |
| 517 | .fg(Color::White) |
| 518 | .add_modifier(Modifier::BOLD), |
| 519 | ), |
| 520 | ])); |
| 521 | lines.push(Line::from(vec![ |
| 522 | Span::styled(" Layers: ", Style::default().fg(Color::DarkGray)), |
| 523 | Span::styled( |
| 524 | format!("{}", topo.num_layers), |
| 525 | Style::default().fg(Color::White), |
| 526 | ), |
| 527 | Span::styled(" dtype: ", Style::default().fg(Color::DarkGray)), |
| 528 | Span::styled(topo.dtype.clone(), Style::default().fg(Color::White)), |
| 529 | Span::styled(" memory: ", Style::default().fg(Color::DarkGray)), |
| 530 | Span::styled( |
| 531 | human_bytes(topo.memory_bytes), |
| 532 | Style::default().fg(Color::White), |
| 533 | ), |
| 534 | ])); |
| 535 | lines.push(Line::from("")); |
| 536 | lines.push(Line::from(Span::styled( |
| 537 | format!(" {}", "-".repeat(width.saturating_sub(4))), |
| 538 | Style::default().fg(Color::DarkGray), |
| 539 | ))); |
| 540 | |
| 541 | // ── Master node ── |
| 542 | let master_label = if topo.master.hostname.is_empty() { |
| 543 | "master".to_string() |
| 544 | } else { |
| 545 | topo.master.hostname.clone() |
| 546 | }; |
| 547 | render_node( |
| 548 | &mut lines, |
| 549 | &master_label, |
| 550 | &topo.master.backend, |
| 551 | &topo.master.os, |
| 552 | topo.master.vram_bytes, |
| 553 | topo.master.tflops, |
| 554 | &topo.master.layers, |
| 555 | max_vram, |
| 556 | bar_max_width, |
| 557 | Color::Yellow, |
no test coverage detected