mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-06-30 06:12:09 -06:00
| .. | ||
| collector_background.py | ||
| README.md | ||
Background ResourceMetricCollector
Demonstrates nvitop.collect_in_background: the collector ticks on a daemon thread, calls your on_collect callback with each sample, and shuts itself down cleanly when the callback returns False. A small InMemoryLogger stands in for whatever sink (TensorBoard, file, Slack webhook, …) you would normally write to.
APIs Used
The same pattern is available as a one-liner via ResourceMetricCollector.daemonize.
Run
python3 examples/collector-background/collector_background.py
The script collects in the background for ~10 seconds and prints each tick.
See ../README.md for the full example index.