hytop 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hytop-0.1.0/.gitignore +216 -0
- hytop-0.1.0/LICENSE +21 -0
- hytop-0.1.0/Makefile +39 -0
- hytop-0.1.0/PKG-INFO +180 -0
- hytop-0.1.0/README.md +156 -0
- hytop-0.1.0/pyproject.toml +64 -0
- hytop-0.1.0/src/hytop/__init__.py +3 -0
- hytop-0.1.0/src/hytop/_bump.py +123 -0
- hytop-0.1.0/src/hytop/core/__init__.py +1 -0
- hytop-0.1.0/src/hytop/core/history.py +70 -0
- hytop-0.1.0/src/hytop/core/ssh.py +84 -0
- hytop-0.1.0/src/hytop/core/validators.py +71 -0
- hytop-0.1.0/src/hytop/cpu/__init__.py +1 -0
- hytop-0.1.0/src/hytop/cpu/cli.py +15 -0
- hytop-0.1.0/src/hytop/gpu/__init__.py +1 -0
- hytop-0.1.0/src/hytop/gpu/cli.py +135 -0
- hytop-0.1.0/src/hytop/gpu/metrics.py +126 -0
- hytop-0.1.0/src/hytop/gpu/models.py +86 -0
- hytop-0.1.0/src/hytop/gpu/parser.py +85 -0
- hytop-0.1.0/src/hytop/gpu/render.py +141 -0
- hytop-0.1.0/src/hytop/gpu/service.py +362 -0
- hytop-0.1.0/src/hytop/main.py +81 -0
- hytop-0.1.0/tests/__init__.py +0 -0
- hytop-0.1.0/tests/test_history.py +94 -0
- hytop-0.1.0/tests/test_metrics.py +84 -0
- hytop-0.1.0/tests/test_parser.py +151 -0
- hytop-0.1.0/tests/test_render.py +68 -0
- hytop-0.1.0/tests/test_service.py +219 -0
- hytop-0.1.0/tests/test_ssh.py +106 -0
- hytop-0.1.0/tests/test_validators.py +104 -0
- hytop-0.1.0/uv.lock +271 -0
hytop-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
|
|
204
|
+
# Ruff stuff:
|
|
205
|
+
.ruff_cache/
|
|
206
|
+
|
|
207
|
+
# PyPI configuration file
|
|
208
|
+
.pypirc
|
|
209
|
+
|
|
210
|
+
# Marimo
|
|
211
|
+
marimo/_static/
|
|
212
|
+
marimo/_lsp/
|
|
213
|
+
__marimo__/
|
|
214
|
+
|
|
215
|
+
# Streamlit
|
|
216
|
+
.streamlit/secrets.toml
|
hytop-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 alephpiece
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
hytop-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.PHONY: help setup format lint test clean bump build
|
|
2
|
+
|
|
3
|
+
help:
|
|
4
|
+
@echo "Available targets:"
|
|
5
|
+
@echo " make setup - Create venv, install all dependencies, and set up git hooks"
|
|
6
|
+
@echo " make format - Auto-fix and format code (ruff)"
|
|
7
|
+
@echo " make lint - Check code style and errors without modifying files (ruff)"
|
|
8
|
+
@echo " make test - Run all unit tests (pytest)"
|
|
9
|
+
@echo " make clean - Remove build caches and the virtual environment"
|
|
10
|
+
@echo " make bump part=X - Bump version (patch/minor/major or set X.Y.Z)"
|
|
11
|
+
@echo " make build - Build wheel and sdist into dist/"
|
|
12
|
+
|
|
13
|
+
setup:
|
|
14
|
+
@echo ">> Initializing virtual environment and installing dependencies..."
|
|
15
|
+
uv sync --group dev
|
|
16
|
+
@echo ">> Installing pre-commit git hooks..."
|
|
17
|
+
uvx pre-commit install
|
|
18
|
+
|
|
19
|
+
format:
|
|
20
|
+
uv run ruff check --fix src/ tests/
|
|
21
|
+
uv run ruff format src/ tests/
|
|
22
|
+
|
|
23
|
+
lint:
|
|
24
|
+
uv run ruff check src/ tests/
|
|
25
|
+
uv run ruff format --check src/ tests/
|
|
26
|
+
|
|
27
|
+
test:
|
|
28
|
+
uv run pytest -v
|
|
29
|
+
|
|
30
|
+
clean:
|
|
31
|
+
rm -rf .pytest_cache .ruff_cache .venv
|
|
32
|
+
find src tests -type f -name "*.pyc" -delete
|
|
33
|
+
find src tests -type d -name "__pycache__" -delete
|
|
34
|
+
|
|
35
|
+
bump:
|
|
36
|
+
uv run python -m hytop._bump $(part)
|
|
37
|
+
|
|
38
|
+
build:
|
|
39
|
+
uv build
|
hytop-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hytop
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Lightweight monitoring toolkit for Hygon DCU clusters
|
|
5
|
+
Project-URL: Homepage, https://github.com/alephpiece/hg-misc-tools
|
|
6
|
+
Project-URL: Repository, https://github.com/alephpiece/hg-misc-tools
|
|
7
|
+
Project-URL: Issues, https://github.com/alephpiece/hg-misc-tools/issues
|
|
8
|
+
Author-email: alephpiece <wangan.cs@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: dcu,gpu,hygon,hytop,monitoring
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: rich>=14
|
|
22
|
+
Requires-Dist: typer>=0.23
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# hytop - monitoring tools
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
uv:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uv run hytop --help
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
pip:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install .
|
|
39
|
+
hytop --help
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
pipx:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pipx install .
|
|
46
|
+
hytop --help
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Prerequisites
|
|
50
|
+
|
|
51
|
+
- Python >= 3.10
|
|
52
|
+
- Python packages: `rich`, `typer`
|
|
53
|
+
- Passwordless SSH for remote
|
|
54
|
+
|
|
55
|
+
## `hytop`
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Show the version number
|
|
59
|
+
hytop --version
|
|
60
|
+
|
|
61
|
+
# Specify a timeout for the subcommand
|
|
62
|
+
hytop --timeout 300 [COMMAND]
|
|
63
|
+
|
|
64
|
+
# 0.5-second interval and 5-second rolling window for the subcommand
|
|
65
|
+
hytop -n 0.5 --window 5 [COMMAND]
|
|
66
|
+
|
|
67
|
+
# Specify a list of nodes for the subcommand
|
|
68
|
+
hytop -H node01,node02 [COMMAND]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## `hytop gpu`
|
|
72
|
+
|
|
73
|
+
A lightweight script for live `hy-smi` polling with rolling averages across multiple hosts. It features a modern terminal UI and can be used as a blocking scheduler for GPU jobs.
|
|
74
|
+
|
|
75
|
+
### Usage
|
|
76
|
+
|
|
77
|
+
Simple examples:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Local node, all GPUs
|
|
81
|
+
hytop gpu
|
|
82
|
+
|
|
83
|
+
# Two nodes, 0.5-second interval
|
|
84
|
+
hytop -H node01,node02 -n 0.5 gpu
|
|
85
|
+
|
|
86
|
+
# Exit with code 0 when all monitored GPUs are available
|
|
87
|
+
hytop gpu --devices 0,1 --wait-idle
|
|
88
|
+
|
|
89
|
+
# Wait for GPUs to be idle for 30 seconds before exiting
|
|
90
|
+
hytop gpu --devices 0,1 --wait-idle --wait-idle-seconds 30
|
|
91
|
+
|
|
92
|
+
# Wait at most 300s for availability (exit 124 on timeout)
|
|
93
|
+
hytop gpu --devices 0,1 --wait-idle --timeout 300
|
|
94
|
+
|
|
95
|
+
# Fine-grained columns (output order follows show-flag order)
|
|
96
|
+
hytop gpu --showtemp --showpower
|
|
97
|
+
hytop gpu --showpower --showtemp
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Queue jobs in shared environments:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
if hytop -H node01,node02 gpu --timeout 300 --wait-idle; then
|
|
104
|
+
echo "GPUs available, starting workload..."
|
|
105
|
+
# YOUR COMMAND HERE (e.g., python train.py)
|
|
106
|
+
else
|
|
107
|
+
echo "Error: GPUs not available in time, aborting pipeline."
|
|
108
|
+
fi
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Exit Codes
|
|
112
|
+
|
|
113
|
+
Designed to be script-friendly:
|
|
114
|
+
|
|
115
|
+
* `0`: Availability condition met (GPUs are idle).
|
|
116
|
+
* `124`: Timeout reached before the availability condition was met.
|
|
117
|
+
* `130`: Interrupted by the user (Ctrl+C).
|
|
118
|
+
* `2`: Argument or input error.
|
|
119
|
+
|
|
120
|
+
### Fine-grained metric flags
|
|
121
|
+
|
|
122
|
+
`hytop gpu` uses formatted `hy-smi --json` output and supports a subset of `hy-smi` `--show*` flags:
|
|
123
|
+
|
|
124
|
+
- `--showtemp`: GPU core temperature (`Temp`)
|
|
125
|
+
- `--showpower`: average package power (`AvgPwr`, plus `AvgPwr@window`)
|
|
126
|
+
- `--showsclk`: sclk frequency (`sclk`)
|
|
127
|
+
- `--showmemuse`: VRAM usage (`VRAM%`)
|
|
128
|
+
- `--showuse`: GPU utilization (`GPU%`, plus `GPU%@window`)
|
|
129
|
+
|
|
130
|
+
If no `--show*` flags are specified, hytop defaults to:
|
|
131
|
+
`--showtemp --showpower --showsclk --showmemuse --showuse`.
|
|
132
|
+
|
|
133
|
+
## Development
|
|
134
|
+
|
|
135
|
+
Clone the repo and run `make setup` to create the virtual environment, install all dependencies (including dev), and configure pre-commit hooks:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
make setup
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Common development commands:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
make format # Auto-fix and format code (ruff)
|
|
145
|
+
make lint # Check code style and errors without modifying files
|
|
146
|
+
make test # Run all unit tests (pytest)
|
|
147
|
+
make bump part=patch # Bump version (patch/minor/major or X.Y.Z)
|
|
148
|
+
make clean # Remove build caches and the virtual environment
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Version bump
|
|
152
|
+
|
|
153
|
+
Version is sourced from `src/hytop/__init__.py` (`__version__`).
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
make bump part=patch # 0.1.0 -> 0.1.1
|
|
157
|
+
make bump part=minor # 0.1.1 -> 0.2.0
|
|
158
|
+
make bump part=major # 0.2.0 -> 1.0.0
|
|
159
|
+
make bump part="set 1.2.3" # set an explicit version
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Publish
|
|
163
|
+
|
|
164
|
+
Releases are automatically published to PyPI when pushing a version tag:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Bump version and commit
|
|
168
|
+
make bump part=patch
|
|
169
|
+
git commit -am "Bump version to 0.1.1"
|
|
170
|
+
|
|
171
|
+
# Tag and push to trigger GitHub Actions release
|
|
172
|
+
git tag hytop-0.1.1
|
|
173
|
+
git push origin hytop-0.1.1
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
To test building distributions locally:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
make build
|
|
180
|
+
```
|
hytop-0.1.0/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# hytop - monitoring tools
|
|
2
|
+
|
|
3
|
+
## Quick start
|
|
4
|
+
|
|
5
|
+
uv:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv run hytop --help
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
pip:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install .
|
|
15
|
+
hytop --help
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
pipx:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pipx install .
|
|
22
|
+
hytop --help
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Prerequisites
|
|
26
|
+
|
|
27
|
+
- Python >= 3.10
|
|
28
|
+
- Python packages: `rich`, `typer`
|
|
29
|
+
- Passwordless SSH for remote
|
|
30
|
+
|
|
31
|
+
## `hytop`
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Show the version number
|
|
35
|
+
hytop --version
|
|
36
|
+
|
|
37
|
+
# Specify a timeout for the subcommand
|
|
38
|
+
hytop --timeout 300 [COMMAND]
|
|
39
|
+
|
|
40
|
+
# 0.5-second interval and 5-second rolling window for the subcommand
|
|
41
|
+
hytop -n 0.5 --window 5 [COMMAND]
|
|
42
|
+
|
|
43
|
+
# Specify a list of nodes for the subcommand
|
|
44
|
+
hytop -H node01,node02 [COMMAND]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## `hytop gpu`
|
|
48
|
+
|
|
49
|
+
A lightweight script for live `hy-smi` polling with rolling averages across multiple hosts. It features a modern terminal UI and can be used as a blocking scheduler for GPU jobs.
|
|
50
|
+
|
|
51
|
+
### Usage
|
|
52
|
+
|
|
53
|
+
Simple examples:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Local node, all GPUs
|
|
57
|
+
hytop gpu
|
|
58
|
+
|
|
59
|
+
# Two nodes, 0.5-second interval
|
|
60
|
+
hytop -H node01,node02 -n 0.5 gpu
|
|
61
|
+
|
|
62
|
+
# Exit with code 0 when all monitored GPUs are available
|
|
63
|
+
hytop gpu --devices 0,1 --wait-idle
|
|
64
|
+
|
|
65
|
+
# Wait for GPUs to be idle for 30 seconds before exiting
|
|
66
|
+
hytop gpu --devices 0,1 --wait-idle --wait-idle-seconds 30
|
|
67
|
+
|
|
68
|
+
# Wait at most 300s for availability (exit 124 on timeout)
|
|
69
|
+
hytop gpu --devices 0,1 --wait-idle --timeout 300
|
|
70
|
+
|
|
71
|
+
# Fine-grained columns (output order follows show-flag order)
|
|
72
|
+
hytop gpu --showtemp --showpower
|
|
73
|
+
hytop gpu --showpower --showtemp
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Queue jobs in shared environments:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
if hytop -H node01,node02 gpu --timeout 300 --wait-idle; then
|
|
80
|
+
echo "GPUs available, starting workload..."
|
|
81
|
+
# YOUR COMMAND HERE (e.g., python train.py)
|
|
82
|
+
else
|
|
83
|
+
echo "Error: GPUs not available in time, aborting pipeline."
|
|
84
|
+
fi
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Exit Codes
|
|
88
|
+
|
|
89
|
+
Designed to be script-friendly:
|
|
90
|
+
|
|
91
|
+
* `0`: Availability condition met (GPUs are idle).
|
|
92
|
+
* `124`: Timeout reached before the availability condition was met.
|
|
93
|
+
* `130`: Interrupted by the user (Ctrl+C).
|
|
94
|
+
* `2`: Argument or input error.
|
|
95
|
+
|
|
96
|
+
### Fine-grained metric flags
|
|
97
|
+
|
|
98
|
+
`hytop gpu` uses formatted `hy-smi --json` output and supports a subset of `hy-smi` `--show*` flags:
|
|
99
|
+
|
|
100
|
+
- `--showtemp`: GPU core temperature (`Temp`)
|
|
101
|
+
- `--showpower`: average package power (`AvgPwr`, plus `AvgPwr@window`)
|
|
102
|
+
- `--showsclk`: sclk frequency (`sclk`)
|
|
103
|
+
- `--showmemuse`: VRAM usage (`VRAM%`)
|
|
104
|
+
- `--showuse`: GPU utilization (`GPU%`, plus `GPU%@window`)
|
|
105
|
+
|
|
106
|
+
If no `--show*` flags are specified, hytop defaults to:
|
|
107
|
+
`--showtemp --showpower --showsclk --showmemuse --showuse`.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
Clone the repo and run `make setup` to create the virtual environment, install all dependencies (including dev), and configure pre-commit hooks:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
make setup
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Common development commands:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
make format # Auto-fix and format code (ruff)
|
|
121
|
+
make lint # Check code style and errors without modifying files
|
|
122
|
+
make test # Run all unit tests (pytest)
|
|
123
|
+
make bump part=patch # Bump version (patch/minor/major or X.Y.Z)
|
|
124
|
+
make clean # Remove build caches and the virtual environment
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Version bump
|
|
128
|
+
|
|
129
|
+
Version is sourced from `src/hytop/__init__.py` (`__version__`).
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
make bump part=patch # 0.1.0 -> 0.1.1
|
|
133
|
+
make bump part=minor # 0.1.1 -> 0.2.0
|
|
134
|
+
make bump part=major # 0.2.0 -> 1.0.0
|
|
135
|
+
make bump part="set 1.2.3" # set an explicit version
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Publish
|
|
139
|
+
|
|
140
|
+
Releases are automatically published to PyPI when pushing a version tag:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Bump version and commit
|
|
144
|
+
make bump part=patch
|
|
145
|
+
git commit -am "Bump version to 0.1.1"
|
|
146
|
+
|
|
147
|
+
# Tag and push to trigger GitHub Actions release
|
|
148
|
+
git tag hytop-0.1.1
|
|
149
|
+
git push origin hytop-0.1.1
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
To test building distributions locally:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
make build
|
|
156
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "hytop"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Lightweight monitoring toolkit for Hygon DCU clusters"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
authors = [{ name = "alephpiece", email = "wangan.cs@gmail.com" }]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
dependencies = ["rich>=14", "typer>=0.23"]
|
|
14
|
+
keywords = ["monitoring", "gpu", "dcu", "hygon", "hytop"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Operating System :: POSIX :: Linux",
|
|
23
|
+
"Environment :: Console",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/alephpiece/hg-misc-tools"
|
|
28
|
+
Repository = "https://github.com/alephpiece/hg-misc-tools"
|
|
29
|
+
Issues = "https://github.com/alephpiece/hg-misc-tools/issues"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
hytop = "hytop.main:main"
|
|
33
|
+
|
|
34
|
+
[dependency-groups]
|
|
35
|
+
dev = ["pytest>=8", "ruff>=0.15"]
|
|
36
|
+
|
|
37
|
+
[tool.hatch.version]
|
|
38
|
+
path = "src/hytop/__init__.py"
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.wheel]
|
|
41
|
+
packages = ["src/hytop"]
|
|
42
|
+
|
|
43
|
+
[tool.hatch.build.targets.sdist]
|
|
44
|
+
exclude = ["tests/__pycache__", ".ruff_cache", ".pytest_cache"]
|
|
45
|
+
|
|
46
|
+
[tool.pytest.ini_options]
|
|
47
|
+
testpaths = ["tests"]
|
|
48
|
+
|
|
49
|
+
[tool.ruff]
|
|
50
|
+
target-version = "py310"
|
|
51
|
+
line-length = 100
|
|
52
|
+
src = ["src", "tests"]
|
|
53
|
+
|
|
54
|
+
[tool.ruff.lint]
|
|
55
|
+
select = [
|
|
56
|
+
"F", # pyflakes
|
|
57
|
+
"E", # pycodestyle errors
|
|
58
|
+
"W", # pycodestyle warnings
|
|
59
|
+
"I", # isort
|
|
60
|
+
"UP", # pyupgrade
|
|
61
|
+
"B", # flake8-bugbear
|
|
62
|
+
"SIM", # flake8-simplify
|
|
63
|
+
"RUF", # ruff-specific
|
|
64
|
+
]
|