[PR #231] [MERGED] feat(examples): add a Rich Live GPU monitor #229

Closed
opened 2026-10-23 22:05:40 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/XuehaiPan/nvitop/pull/231
Author: @XuehaiPan
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/17/2026
Merged by: @XuehaiPan

Base: main ← Head: feat/rich-monitor


📝 Commits (3)

  • 8928706 feat(examples): add a Rich Live GPU monitor
  • 2486849 fix(examples): allow optional Rich imports during linting
  • 02a2b26 docs(changelog): note the Rich Live GPU monitor example

📊 Changes

5 files changed (+471 additions, -0 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 examples/README.md (+2 -0)
➕ examples/monitor-rich/README.md (+44 -0)
➕ examples/monitor-rich/monitor_rich.py (+422 -0)
➕ examples/monitor-rich/requirements.txt (+2 -0)

📄 Description

Issue Type

  • Improvement/feature implementation

Description

Add a standalone Rich Live dashboard that displays host CPU, memory, swap, load averages, physical GPUs, MIG instances, and GPU processes using the public nvitop API.

examples/monitor-rich/
├── monitor_rich.py   # responsive dashboard and one-shot output
├── requirements.txt # nvitop and Rich
└── README.md        # local/remote usage and screenshot

Tables adapt to terminal width, prioritize memory utilization bars, and align percentage values. The monitor redraws on resize, restores the terminal on exit, and supports --interval, --once, and redirected output. Device and MIG instances are discovered once at startup and reused during refreshes.

Closes #230

Motivation and Context

Implements the standalone Rich example suggested in PR #230, providing an adaptable dashboard built on the public API.

Testing

  • Full python3 -m pre_commit run --all-files passed, including mypy and pylint.
  • Live H200 one-shot output and PTY refresh, resize, overflow, and terminal restoration checks passed.
  • Synthetic rendering checks covered narrow terminals, long usernames, large CPU/power values, MIG instances, unavailable metrics, and 100.0% memory usage.
  • Percentage alignment regression: mixed 0.4% / 26.9% rows previously ended in different columns; the corrected rendering aligns values and headers across widths 60–120.

MIG validation used synthetic snapshots. One-shot process CPU percentages use the initial sample and may report zero before a useful sampling interval has elapsed.

Images / Videos

Rich Live dashboard


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/XuehaiPan/nvitop/pull/231 **Author:** [@XuehaiPan](https://github.com/XuehaiPan) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@XuehaiPan](https://github.com/XuehaiPan) **Base:** `main` ← **Head:** `feat/rich-monitor` --- ### 📝 Commits (3) - [`8928706`](https://github.com/XuehaiPan/nvitop/commit/892870698b266c1a121cfb755a6a67bc5aa5a625) feat(examples): add a Rich Live GPU monitor - [`2486849`](https://github.com/XuehaiPan/nvitop/commit/248684906d3a32ddf24d0a2dd705bf6b414ed68a) fix(examples): allow optional Rich imports during linting - [`02a2b26`](https://github.com/XuehaiPan/nvitop/commit/02a2b26d1a77efa6fc52751ec16177c516ed4f2f) docs(changelog): note the Rich Live GPU monitor example ### 📊 Changes **5 files changed** (+471 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `examples/README.md` (+2 -0) ➕ `examples/monitor-rich/README.md` (+44 -0) ➕ `examples/monitor-rich/monitor_rich.py` (+422 -0) ➕ `examples/monitor-rich/requirements.txt` (+2 -0) </details> ### 📄 Description #### Issue Type - Improvement/feature implementation #### Description Add a standalone Rich Live dashboard that displays host CPU, memory, swap, load averages, physical GPUs, MIG instances, and GPU processes using the public `nvitop` API. ```text examples/monitor-rich/ ├── monitor_rich.py # responsive dashboard and one-shot output ├── requirements.txt # nvitop and Rich └── README.md # local/remote usage and screenshot ``` Tables adapt to terminal width, prioritize memory utilization bars, and align percentage values. The monitor redraws on resize, restores the terminal on exit, and supports `--interval`, `--once`, and redirected output. Device and MIG instances are discovered once at startup and reused during refreshes. Closes #230 #### Motivation and Context Implements the [standalone Rich example suggested in PR #230](https://github.com/XuehaiPan/nvitop/pull/230#issuecomment-6213340166), providing an adaptable dashboard built on the public API. #### Testing - Full `python3 -m pre_commit run --all-files` passed, including mypy and pylint. - Live H200 one-shot output and PTY refresh, resize, overflow, and terminal restoration checks passed. - Synthetic rendering checks covered narrow terminals, long usernames, large CPU/power values, MIG instances, unavailable metrics, and `100.0%` memory usage. - Percentage alignment regression: mixed `0.4%` / `26.9%` rows previously ended in different columns; the corrected rendering aligns values and headers across widths 60–120. MIG validation used synthetic snapshots. One-shot process CPU percentages use the initial sample and may report zero before a useful sampling interval has elapsed. #### Images / Videos ![Rich Live dashboard](https://github.com/user-attachments/assets/2dabdf79-a821-4a1a-91d0-a7fb6dedffba) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-10-23 22:05:40 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github-starred/nvitop#229
No description provided.