ZBoost 1.0.5__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.
Potentially problematic release.
This version of ZBoost might be problematic. Click here for more details.
- zboost-1.0.5/LICENSE +3 -0
- zboost-1.0.5/PKG-INFO +226 -0
- zboost-1.0.5/README.md +195 -0
- zboost-1.0.5/pyproject.toml +131 -0
- zboost-1.0.5/setup.cfg +4 -0
- zboost-1.0.5/src/ZBoost.egg-info/PKG-INFO +226 -0
- zboost-1.0.5/src/ZBoost.egg-info/SOURCES.txt +135 -0
- zboost-1.0.5/src/ZBoost.egg-info/dependency_links.txt +1 -0
- zboost-1.0.5/src/ZBoost.egg-info/requires.txt +8 -0
- zboost-1.0.5/src/ZBoost.egg-info/top_level.txt +1 -0
- zboost-1.0.5/src/boost/__init__.py +10 -0
- zboost-1.0.5/src/boost/cli/__init__.py +2 -0
- zboost-1.0.5/src/boost/cli/wrapper.py +823 -0
- zboost-1.0.5/src/boost/common/__init__.py +2 -0
- zboost-1.0.5/src/boost/common/global_.py +8 -0
- zboost-1.0.5/src/boost/core/__init__.py +2 -0
- zboost-1.0.5/src/boost/core/agent/__init__.py +2 -0
- zboost-1.0.5/src/boost/core/agent/agent_info.py +12 -0
- zboost-1.0.5/src/boost/core/agent/agent_list.py +12 -0
- zboost-1.0.5/src/boost/core/agent/agent_provision.py +22 -0
- zboost-1.0.5/src/boost/core/agent/agent_query.py +22 -0
- zboost-1.0.5/src/boost/core/agent/agent_run.py +55 -0
- zboost-1.0.5/src/boost/core/agent/agent_service_disable.py +12 -0
- zboost-1.0.5/src/boost/core/agent/agent_service_enable.py +12 -0
- zboost-1.0.5/src/boost/core/agent/agent_service_install.py +12 -0
- zboost-1.0.5/src/boost/core/agent/agent_service_restart.py +12 -0
- zboost-1.0.5/src/boost/core/agent/agent_service_start.py +12 -0
- zboost-1.0.5/src/boost/core/agent/agent_service_status.py +12 -0
- zboost-1.0.5/src/boost/core/agent/agent_service_stop.py +12 -0
- zboost-1.0.5/src/boost/core/agent/agent_service_uninstall.py +12 -0
- zboost-1.0.5/src/boost/core/client/__init__.py +2 -0
- zboost-1.0.5/src/boost/core/client/client_service_disable.py +20 -0
- zboost-1.0.5/src/boost/core/client/client_service_enable.py +20 -0
- zboost-1.0.5/src/boost/core/client/client_service_install.py +20 -0
- zboost-1.0.5/src/boost/core/client/client_service_restart.py +20 -0
- zboost-1.0.5/src/boost/core/client/client_service_run.py +20 -0
- zboost-1.0.5/src/boost/core/client/client_service_start.py +20 -0
- zboost-1.0.5/src/boost/core/client/client_service_status.py +20 -0
- zboost-1.0.5/src/boost/core/client/client_service_stop.py +20 -0
- zboost-1.0.5/src/boost/core/client/client_service_uninstall.py +20 -0
- zboost-1.0.5/src/boost/core/config/__init__.py +2 -0
- zboost-1.0.5/src/boost/core/config/config_get.py +21 -0
- zboost-1.0.5/src/boost/core/config/config_list.py +20 -0
- zboost-1.0.5/src/boost/core/config/config_set.py +22 -0
- zboost-1.0.5/src/boost/core/config/config_unset.py +21 -0
- zboost-1.0.5/src/boost/core/context/__init__.py +2 -0
- zboost-1.0.5/src/boost/core/context/context_activate.py +21 -0
- zboost-1.0.5/src/boost/core/context/context_list.py +20 -0
- zboost-1.0.5/src/boost/core/context/context_remove.py +21 -0
- zboost-1.0.5/src/boost/core/debug/__init__.py +2 -0
- zboost-1.0.5/src/boost/core/debug/debug_flags.py +21 -0
- zboost-1.0.5/src/boost/core/debug/debug_gather_logs.py +23 -0
- zboost-1.0.5/src/boost/core/gpu/__init__.py +2 -0
- zboost-1.0.5/src/boost/core/gpu/gpu_data.py +24 -0
- zboost-1.0.5/src/boost/core/gpu/gpu_info.py +21 -0
- zboost-1.0.5/src/boost/core/gpu/gpu_list.py +18 -0
- zboost-1.0.5/src/boost/core/gpu/gpu_query.py +22 -0
- zboost-1.0.5/src/boost/core/help.py +13 -0
- zboost-1.0.5/src/boost/core/m2m/__init__.py +2 -0
- zboost-1.0.5/src/boost/core/m2m/m2m_create.py +13 -0
- zboost-1.0.5/src/boost/core/m2m/m2m_list.py +17 -0
- zboost-1.0.5/src/boost/core/m2m/m2m_login.py +15 -0
- zboost-1.0.5/src/boost/core/m2m/m2m_remove.py +12 -0
- zboost-1.0.5/src/boost/core/organization/__init__.py +2 -0
- zboost-1.0.5/src/boost/core/organization/organization_list.py +21 -0
- zboost-1.0.5/src/boost/core/pool_list.py +16 -0
- zboost-1.0.5/src/boost/core/release/__init__.py +2 -0
- zboost-1.0.5/src/boost/core/release/check_install.py +12 -0
- zboost-1.0.5/src/boost/core/release/release_admin_create.py +23 -0
- zboost-1.0.5/src/boost/core/release/release_admin_list.py +22 -0
- zboost-1.0.5/src/boost/core/release/release_admin_update.py +26 -0
- zboost-1.0.5/src/boost/core/release/release_download.py +16 -0
- zboost-1.0.5/src/boost/core/release/release_list.py +20 -0
- zboost-1.0.5/src/boost/core/session/__init__.py +2 -0
- zboost-1.0.5/src/boost/core/session/login.py +23 -0
- zboost-1.0.5/src/boost/core/session/logout.py +12 -0
- zboost-1.0.5/src/boost/core/session/session_add_path.py +12 -0
- zboost-1.0.5/src/boost/core/session/session_list.py +13 -0
- zboost-1.0.5/src/boost/core/session/session_list_paths.py +20 -0
- zboost-1.0.5/src/boost/core/session/session_release.py +12 -0
- zboost-1.0.5/src/boost/core/session/session_remove_path.py +21 -0
- zboost-1.0.5/src/boost/core/session/session_request.py +37 -0
- zboost-1.0.5/src/boost/core/user_info.py +17 -0
- zboost-1.0.5/src/boost/data/__init__.py +2 -0
- zboost-1.0.5/src/boost/data/boost_cli.json +766 -0
- zboost-1.0.5/src/boost/py.typed +0 -0
- zboost-1.0.5/src/boost/scheduling/__init__.py +2 -0
- zboost-1.0.5/src/boost/scheduling/add_task.py +22 -0
- zboost-1.0.5/src/boost/scheduling/decorators.py +102 -0
- zboost-1.0.5/src/boost/scheduling/rescheduling.py +25 -0
- zboost-1.0.5/src/boost/scheduling/scheduler.py +429 -0
- zboost-1.0.5/src/boost/utils/__init__.py +2 -0
- zboost-1.0.5/src/boost/utils/boostchk.py +25 -0
- zboost-1.0.5/src/boost/utils/envar.py +10 -0
- zboost-1.0.5/src/boost/utils/exceptions.py +20 -0
- zboost-1.0.5/src/boost/utils/gpu/__init__.py +2 -0
- zboost-1.0.5/src/boost/utils/gpu/gpu_detect.py +27 -0
- zboost-1.0.5/src/boost/utils/gpu/gpu_info.py +85 -0
- zboost-1.0.5/src/boost/utils/logger.py +64 -0
- zboost-1.0.5/src/boost/utils/run_async.py +36 -0
- zboost-1.0.5/src/boost/utils/timer.py +55 -0
- zboost-1.0.5/src/boost/utils/torch/__init__.py +2 -0
- zboost-1.0.5/src/boost/utils/torch/pytorch_cuda_sysinfo.py +211 -0
- zboost-1.0.5/src/boost/utils/torch/torch_memory_allocation.py +45 -0
- zboost-1.0.5/src/boost/workload/__init__.py +2 -0
- zboost-1.0.5/src/boost/workload/runner.py +121 -0
- zboost-1.0.5/tests/test_boostchk.py +55 -0
- zboost-1.0.5/tests/test_cli_wrapper.py +862 -0
- zboost-1.0.5/tests/test_core_agent.py +343 -0
- zboost-1.0.5/tests/test_core_client.py +276 -0
- zboost-1.0.5/tests/test_core_config.py +135 -0
- zboost-1.0.5/tests/test_core_context.py +104 -0
- zboost-1.0.5/tests/test_core_debug.py +80 -0
- zboost-1.0.5/tests/test_core_gpu.py +100 -0
- zboost-1.0.5/tests/test_core_gpu_extended.py +54 -0
- zboost-1.0.5/tests/test_core_m2m.py +116 -0
- zboost-1.0.5/tests/test_core_organization.py +53 -0
- zboost-1.0.5/tests/test_core_release_admin.py +133 -0
- zboost-1.0.5/tests/test_core_release_help.py +120 -0
- zboost-1.0.5/tests/test_core_session.py +66 -0
- zboost-1.0.5/tests/test_core_session_login_logout.py +74 -0
- zboost-1.0.5/tests/test_decorators.py +59 -0
- zboost-1.0.5/tests/test_envar.py +23 -0
- zboost-1.0.5/tests/test_exceptions.py +25 -0
- zboost-1.0.5/tests/test_gpu_detect_safe.py +84 -0
- zboost-1.0.5/tests/test_logger.py +15 -0
- zboost-1.0.5/tests/test_scheduler.py +724 -0
- zboost-1.0.5/tests/test_scheduler_queue.py +61 -0
- zboost-1.0.5/tests/test_scheduling_add_task.py +64 -0
- zboost-1.0.5/tests/test_scheduling_rescheduling.py +102 -0
- zboost-1.0.5/tests/test_timer.py +111 -0
- zboost-1.0.5/tests/test_torch_cuda_sysinfo.py +123 -0
- zboost-1.0.5/tests/test_torch_memory_allocation.py +104 -0
- zboost-1.0.5/tests/test_utils_gpu_info.py +74 -0
- zboost-1.0.5/tests/test_utils_run_async.py +115 -0
- zboost-1.0.5/tests/test_utils_torch_tools.py +788 -0
- zboost-1.0.5/tests/test_workload_runner.py +292 -0
zboost-1.0.5/LICENSE
ADDED
zboost-1.0.5/PKG-INFO
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ZBoost
|
|
3
|
+
Version: 1.0.5
|
|
4
|
+
Summary: HP Z Boost CLI Library
|
|
5
|
+
Author-email: James Dunne <james.dunne@hp.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://www.hp.com/boost
|
|
8
|
+
Project-URL: Repository, https://github.com/hpi-main/solution-boost-cli-library
|
|
9
|
+
Project-URL: Issues, https://github.com/hpi-main/solution-boost-cli-library/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/hpi-main/solution-boost-cli-library/docs
|
|
11
|
+
Project-URL: Changelog, https://github.com/hpi-main/solution-boost-cli-library/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: boost,cli,library
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: apscheduler>=3.11.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest>=8.4.1; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: black>=24.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# Boost CLI Python Library
|
|
33
|
+
|
|
34
|
+
[](https://github.com/hpi-main/solution-boost-cli-library/)
|
|
35
|
+
[](https://www.python.org/downloads/)
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
|
|
38
|
+
A Python wrapper library for the HP Z Boost CLI tool that provides a programmatic interface
|
|
39
|
+
for managing and executing workloads on distributed GPU resources. The library simplifies
|
|
40
|
+
interaction with HP Z Boost infrastructure through Python, enabling automated workload
|
|
41
|
+
scheduling, resource management, and GPU utilisation.
|
|
42
|
+
|
|
43
|
+
## Table of Contents
|
|
44
|
+
|
|
45
|
+
- [Overview](#overview)
|
|
46
|
+
- [Features](#features)
|
|
47
|
+
- [Installation](#installation)
|
|
48
|
+
- [Quick Start](#quick-start)
|
|
49
|
+
- [Scheduled Workload Execution](#scheduled-workload-execution)
|
|
50
|
+
- [Documentation](#documentation)
|
|
51
|
+
- [Testing](#testing)
|
|
52
|
+
- [Contributing](#contributing)
|
|
53
|
+
- [License](#license)
|
|
54
|
+
|
|
55
|
+
## Overview
|
|
56
|
+
|
|
57
|
+
The Boost CLI Python Library (`boost`) wraps the `boost` binary in a clean Python API.
|
|
58
|
+
It provides two layers of access:
|
|
59
|
+
|
|
60
|
+
- **`BoostCli`** (`boost.cli.wrapper`) - thin subprocess wrapper; every CLI command has a
|
|
61
|
+
corresponding method.
|
|
62
|
+
- **`boost.core.*`** - named abstraction functions that compose `BoostCli` with logging,
|
|
63
|
+
for use in production code.
|
|
64
|
+
|
|
65
|
+
Command groups covered: `login`/`logout`, `m2m`, `gpu`, `pool`, `session`,
|
|
66
|
+
`agent`/`agent service`, `agent provision`/`agent query`, `release`, `release admin`,
|
|
67
|
+
`config`, `context`, `client service`, `debug`, `organization`, `user`, `help`, `run`.
|
|
68
|
+
|
|
69
|
+
## Features
|
|
70
|
+
|
|
71
|
+
- Authentication management: `login`, `login_m2m_token`, M2M token create/list/remove
|
|
72
|
+
- Resource discovery: GPU list/query, pool list
|
|
73
|
+
- Workload execution: `run` applications on distributed GPU resources
|
|
74
|
+
- Agent management: list, info, run, provision, query, service lifecycle
|
|
75
|
+
- Session control: request, list, release, add/list/remove paths
|
|
76
|
+
- Release management: list, download, admin create/list/update
|
|
77
|
+
- Configuration: get, set, list, unset per active context
|
|
78
|
+
- Context management: activate, list, remove
|
|
79
|
+
- Client service (Windows): install, uninstall, start, stop, restart, status, enable, disable
|
|
80
|
+
- Debug utilities: gather-logs, flags
|
|
81
|
+
- Organization listing
|
|
82
|
+
- Task scheduling: built-in APScheduler-based scheduler with automatic retry on failure
|
|
83
|
+
- Error handling: `@handle_exceptions` decorator returns `None` on any exception
|
|
84
|
+
|
|
85
|
+
## Installation
|
|
86
|
+
|
|
87
|
+
### Prerequisites
|
|
88
|
+
|
|
89
|
+
- Python 3.12 or higher
|
|
90
|
+
- HP Z Boost CLI (`boost` binary) installed and available on PATH
|
|
91
|
+
|
|
92
|
+
The library calls `sys.exit(1)` at import if the `boost` binary is not found on PATH.
|
|
93
|
+
|
|
94
|
+
### Using uv (recommended)
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Install uv if you do not have it.
|
|
98
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
99
|
+
|
|
100
|
+
# Clone the repository.
|
|
101
|
+
git clone https://github.com/hpi-main/solution-boost-cli-library.git
|
|
102
|
+
cd solution-boost-cli-library
|
|
103
|
+
|
|
104
|
+
# Install all dependencies.
|
|
105
|
+
uv sync
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Using pip
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Create and activate a virtual environment.
|
|
112
|
+
python -m venv .venv
|
|
113
|
+
source .venv/bin/activate # Linux / macOS
|
|
114
|
+
.venv\Scripts\activate.ps1 # Windows
|
|
115
|
+
|
|
116
|
+
# Clone and install.
|
|
117
|
+
git clone https://github.com/hpi-main/solution-boost-cli-library.git
|
|
118
|
+
cd solution-boost-cli-library
|
|
119
|
+
pip install -e .
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Development installation
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Install with dev dependencies (ruff, mypy, pytest, black).
|
|
126
|
+
uv sync --dev
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
See [docs/installation.md](docs/installation.md) for full platform-specific instructions.
|
|
130
|
+
|
|
131
|
+
## Quick Start
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from boost.cli.wrapper import BoostCli
|
|
135
|
+
from boost.core.m2m.m2m_login import m2m_login
|
|
136
|
+
from boost.core.gpu.gpu_list import gpu_list
|
|
137
|
+
from boost.utils.envar import read_env_var
|
|
138
|
+
|
|
139
|
+
# Initialise the client.
|
|
140
|
+
boost_client = BoostCli()
|
|
141
|
+
|
|
142
|
+
# Authenticate using an M2M token stored in the environment.
|
|
143
|
+
token = read_env_var("token")
|
|
144
|
+
m2m_login(boost_client, token, task_id="quick_start")
|
|
145
|
+
|
|
146
|
+
# List available GPUs.
|
|
147
|
+
resources = gpu_list(boost_client, task_id="quick_start")
|
|
148
|
+
print(resources)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Scheduled Workload Execution
|
|
152
|
+
|
|
153
|
+
The scheduler automatically discovers an available GPU, runs the workload, and
|
|
154
|
+
re-schedules 1 minute later if it fails.
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
import os
|
|
158
|
+
from boost.utils.envar import read_env_var
|
|
159
|
+
from boost.common.global_ import lib_log as log
|
|
160
|
+
from boost.scheduling.scheduler import Scheduler
|
|
161
|
+
from boost.scheduling.add_task import add_runtime_task
|
|
162
|
+
from boost.scheduling.decorators import add_task_before_runtime
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def build_scheduler() -> Scheduler:
|
|
166
|
+
scheduler = Scheduler()
|
|
167
|
+
token = read_env_var("token")
|
|
168
|
+
workload = ["python", "your_script.py"]
|
|
169
|
+
|
|
170
|
+
@add_task_before_runtime(scheduler, task_id="boost_task_01")
|
|
171
|
+
async def boost_task_01() -> None:
|
|
172
|
+
if token is None:
|
|
173
|
+
return log.error("Set the 'token' environment variable.")
|
|
174
|
+
task_id = boost_task_01.task_id # type: ignore
|
|
175
|
+
await add_runtime_task(token, workload, scheduler, task_id)
|
|
176
|
+
|
|
177
|
+
return scheduler
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def main() -> None:
|
|
181
|
+
log.info(f"Working directory: {os.getcwd()}")
|
|
182
|
+
scheduler = build_scheduler()
|
|
183
|
+
scheduler.start()
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
if __name__ == "__main__":
|
|
187
|
+
main()
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
See [docs/boost-scheduler.md](docs/boost-scheduler.md) for the full scheduling API.
|
|
191
|
+
|
|
192
|
+
## Documentation
|
|
193
|
+
|
|
194
|
+
| Document | Description |
|
|
195
|
+
|----------|-------------|
|
|
196
|
+
| [docs/boost-library.md](docs/boost-library.md) | Complete API reference for `BoostCli` and `core/` |
|
|
197
|
+
| [docs/boost-scheduler.md](docs/boost-scheduler.md) | Scheduler API and examples |
|
|
198
|
+
| [docs/usage.md](docs/usage.md) | Usage guide with examples for every command group |
|
|
199
|
+
| [docs/installation.md](docs/installation.md) | Installation instructions |
|
|
200
|
+
| [docs/code-style-guide.md](docs/code-style-guide.md) | Code style and contribution guidelines |
|
|
201
|
+
| [examples/](examples/) | Runnable example scripts |
|
|
202
|
+
|
|
203
|
+
## Testing
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Run all tests with coverage.
|
|
207
|
+
uv run pytest
|
|
208
|
+
|
|
209
|
+
# Run a single test file.
|
|
210
|
+
uv run pytest tests/test_cli_wrapper.py
|
|
211
|
+
|
|
212
|
+
# Lint.
|
|
213
|
+
uv run ruff check src/ tests/
|
|
214
|
+
|
|
215
|
+
# Type check.
|
|
216
|
+
uv run mypy src/
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Contributing
|
|
220
|
+
|
|
221
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines and
|
|
222
|
+
[docs/code-style-guide.md](docs/code-style-guide.md) for code style rules.
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
zboost-1.0.5/README.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Boost CLI Python Library
|
|
2
|
+
|
|
3
|
+
[](https://github.com/hpi-main/solution-boost-cli-library/)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
A Python wrapper library for the HP Z Boost CLI tool that provides a programmatic interface
|
|
8
|
+
for managing and executing workloads on distributed GPU resources. The library simplifies
|
|
9
|
+
interaction with HP Z Boost infrastructure through Python, enabling automated workload
|
|
10
|
+
scheduling, resource management, and GPU utilisation.
|
|
11
|
+
|
|
12
|
+
## Table of Contents
|
|
13
|
+
|
|
14
|
+
- [Overview](#overview)
|
|
15
|
+
- [Features](#features)
|
|
16
|
+
- [Installation](#installation)
|
|
17
|
+
- [Quick Start](#quick-start)
|
|
18
|
+
- [Scheduled Workload Execution](#scheduled-workload-execution)
|
|
19
|
+
- [Documentation](#documentation)
|
|
20
|
+
- [Testing](#testing)
|
|
21
|
+
- [Contributing](#contributing)
|
|
22
|
+
- [License](#license)
|
|
23
|
+
|
|
24
|
+
## Overview
|
|
25
|
+
|
|
26
|
+
The Boost CLI Python Library (`boost`) wraps the `boost` binary in a clean Python API.
|
|
27
|
+
It provides two layers of access:
|
|
28
|
+
|
|
29
|
+
- **`BoostCli`** (`boost.cli.wrapper`) - thin subprocess wrapper; every CLI command has a
|
|
30
|
+
corresponding method.
|
|
31
|
+
- **`boost.core.*`** - named abstraction functions that compose `BoostCli` with logging,
|
|
32
|
+
for use in production code.
|
|
33
|
+
|
|
34
|
+
Command groups covered: `login`/`logout`, `m2m`, `gpu`, `pool`, `session`,
|
|
35
|
+
`agent`/`agent service`, `agent provision`/`agent query`, `release`, `release admin`,
|
|
36
|
+
`config`, `context`, `client service`, `debug`, `organization`, `user`, `help`, `run`.
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- Authentication management: `login`, `login_m2m_token`, M2M token create/list/remove
|
|
41
|
+
- Resource discovery: GPU list/query, pool list
|
|
42
|
+
- Workload execution: `run` applications on distributed GPU resources
|
|
43
|
+
- Agent management: list, info, run, provision, query, service lifecycle
|
|
44
|
+
- Session control: request, list, release, add/list/remove paths
|
|
45
|
+
- Release management: list, download, admin create/list/update
|
|
46
|
+
- Configuration: get, set, list, unset per active context
|
|
47
|
+
- Context management: activate, list, remove
|
|
48
|
+
- Client service (Windows): install, uninstall, start, stop, restart, status, enable, disable
|
|
49
|
+
- Debug utilities: gather-logs, flags
|
|
50
|
+
- Organization listing
|
|
51
|
+
- Task scheduling: built-in APScheduler-based scheduler with automatic retry on failure
|
|
52
|
+
- Error handling: `@handle_exceptions` decorator returns `None` on any exception
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
### Prerequisites
|
|
57
|
+
|
|
58
|
+
- Python 3.12 or higher
|
|
59
|
+
- HP Z Boost CLI (`boost` binary) installed and available on PATH
|
|
60
|
+
|
|
61
|
+
The library calls `sys.exit(1)` at import if the `boost` binary is not found on PATH.
|
|
62
|
+
|
|
63
|
+
### Using uv (recommended)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Install uv if you do not have it.
|
|
67
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
68
|
+
|
|
69
|
+
# Clone the repository.
|
|
70
|
+
git clone https://github.com/hpi-main/solution-boost-cli-library.git
|
|
71
|
+
cd solution-boost-cli-library
|
|
72
|
+
|
|
73
|
+
# Install all dependencies.
|
|
74
|
+
uv sync
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Using pip
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Create and activate a virtual environment.
|
|
81
|
+
python -m venv .venv
|
|
82
|
+
source .venv/bin/activate # Linux / macOS
|
|
83
|
+
.venv\Scripts\activate.ps1 # Windows
|
|
84
|
+
|
|
85
|
+
# Clone and install.
|
|
86
|
+
git clone https://github.com/hpi-main/solution-boost-cli-library.git
|
|
87
|
+
cd solution-boost-cli-library
|
|
88
|
+
pip install -e .
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Development installation
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Install with dev dependencies (ruff, mypy, pytest, black).
|
|
95
|
+
uv sync --dev
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
See [docs/installation.md](docs/installation.md) for full platform-specific instructions.
|
|
99
|
+
|
|
100
|
+
## Quick Start
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from boost.cli.wrapper import BoostCli
|
|
104
|
+
from boost.core.m2m.m2m_login import m2m_login
|
|
105
|
+
from boost.core.gpu.gpu_list import gpu_list
|
|
106
|
+
from boost.utils.envar import read_env_var
|
|
107
|
+
|
|
108
|
+
# Initialise the client.
|
|
109
|
+
boost_client = BoostCli()
|
|
110
|
+
|
|
111
|
+
# Authenticate using an M2M token stored in the environment.
|
|
112
|
+
token = read_env_var("token")
|
|
113
|
+
m2m_login(boost_client, token, task_id="quick_start")
|
|
114
|
+
|
|
115
|
+
# List available GPUs.
|
|
116
|
+
resources = gpu_list(boost_client, task_id="quick_start")
|
|
117
|
+
print(resources)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Scheduled Workload Execution
|
|
121
|
+
|
|
122
|
+
The scheduler automatically discovers an available GPU, runs the workload, and
|
|
123
|
+
re-schedules 1 minute later if it fails.
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
import os
|
|
127
|
+
from boost.utils.envar import read_env_var
|
|
128
|
+
from boost.common.global_ import lib_log as log
|
|
129
|
+
from boost.scheduling.scheduler import Scheduler
|
|
130
|
+
from boost.scheduling.add_task import add_runtime_task
|
|
131
|
+
from boost.scheduling.decorators import add_task_before_runtime
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def build_scheduler() -> Scheduler:
|
|
135
|
+
scheduler = Scheduler()
|
|
136
|
+
token = read_env_var("token")
|
|
137
|
+
workload = ["python", "your_script.py"]
|
|
138
|
+
|
|
139
|
+
@add_task_before_runtime(scheduler, task_id="boost_task_01")
|
|
140
|
+
async def boost_task_01() -> None:
|
|
141
|
+
if token is None:
|
|
142
|
+
return log.error("Set the 'token' environment variable.")
|
|
143
|
+
task_id = boost_task_01.task_id # type: ignore
|
|
144
|
+
await add_runtime_task(token, workload, scheduler, task_id)
|
|
145
|
+
|
|
146
|
+
return scheduler
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def main() -> None:
|
|
150
|
+
log.info(f"Working directory: {os.getcwd()}")
|
|
151
|
+
scheduler = build_scheduler()
|
|
152
|
+
scheduler.start()
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
if __name__ == "__main__":
|
|
156
|
+
main()
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
See [docs/boost-scheduler.md](docs/boost-scheduler.md) for the full scheduling API.
|
|
160
|
+
|
|
161
|
+
## Documentation
|
|
162
|
+
|
|
163
|
+
| Document | Description |
|
|
164
|
+
|----------|-------------|
|
|
165
|
+
| [docs/boost-library.md](docs/boost-library.md) | Complete API reference for `BoostCli` and `core/` |
|
|
166
|
+
| [docs/boost-scheduler.md](docs/boost-scheduler.md) | Scheduler API and examples |
|
|
167
|
+
| [docs/usage.md](docs/usage.md) | Usage guide with examples for every command group |
|
|
168
|
+
| [docs/installation.md](docs/installation.md) | Installation instructions |
|
|
169
|
+
| [docs/code-style-guide.md](docs/code-style-guide.md) | Code style and contribution guidelines |
|
|
170
|
+
| [examples/](examples/) | Runnable example scripts |
|
|
171
|
+
|
|
172
|
+
## Testing
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Run all tests with coverage.
|
|
176
|
+
uv run pytest
|
|
177
|
+
|
|
178
|
+
# Run a single test file.
|
|
179
|
+
uv run pytest tests/test_cli_wrapper.py
|
|
180
|
+
|
|
181
|
+
# Lint.
|
|
182
|
+
uv run ruff check src/ tests/
|
|
183
|
+
|
|
184
|
+
# Type check.
|
|
185
|
+
uv run mypy src/
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Contributing
|
|
189
|
+
|
|
190
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines and
|
|
191
|
+
[docs/code-style-guide.md](docs/code-style-guide.md) for code style rules.
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
[tool.ruff.lint]
|
|
2
|
+
# Ignore specific error codes
|
|
3
|
+
ignore = ["E501", "F401", "UP009", "W292", "F841"]
|
|
4
|
+
|
|
5
|
+
[build-system]
|
|
6
|
+
requires = ["setuptools>=45", "wheel"]
|
|
7
|
+
build-backend = "setuptools.build_meta"
|
|
8
|
+
|
|
9
|
+
[project]
|
|
10
|
+
name = "ZBoost"
|
|
11
|
+
version = "1.0.5"
|
|
12
|
+
description = "HP Z Boost CLI Library"
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
requires-python = ">=3.12"
|
|
15
|
+
license = {text = "MIT"}
|
|
16
|
+
keywords = ["boost", "cli", "library"]
|
|
17
|
+
authors = [
|
|
18
|
+
{name = "James Dunne", email = "james.dunne@hp.com"},
|
|
19
|
+
]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 4 - Beta",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
]
|
|
29
|
+
dependencies = [
|
|
30
|
+
"apscheduler>=3.11.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
dev = [
|
|
35
|
+
"ruff>=0.1.0",
|
|
36
|
+
"pytest>=8.4.1",
|
|
37
|
+
"pytest-cov>=4.0.0",
|
|
38
|
+
"black>=24.0.0",
|
|
39
|
+
"mypy>=1.0.0",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "https://www.hp.com/boost"
|
|
44
|
+
Repository = "https://github.com/hpi-main/solution-boost-cli-library"
|
|
45
|
+
Issues = "https://github.com/hpi-main/solution-boost-cli-library/issues"
|
|
46
|
+
Documentation = "https://github.com/hpi-main/solution-boost-cli-library/docs"
|
|
47
|
+
Changelog = "https://github.com/hpi-main/solution-boost-cli-library/blob/main/CHANGELOG.md"
|
|
48
|
+
|
|
49
|
+
[dependency-groups]
|
|
50
|
+
dev = [
|
|
51
|
+
"build>=1.5.0",
|
|
52
|
+
"twine>=6.2.0",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.packages.find]
|
|
56
|
+
where = ["src"]
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.package-data]
|
|
59
|
+
boost = ["py.typed", "data/*.json"]
|
|
60
|
+
|
|
61
|
+
[tool.pytest.ini_options]
|
|
62
|
+
testpaths = ["tests"]
|
|
63
|
+
python_files = ["test_*.py"]
|
|
64
|
+
addopts = [
|
|
65
|
+
"--strict-markers",
|
|
66
|
+
"--strict-config",
|
|
67
|
+
"--cov=src/boost",
|
|
68
|
+
"--cov-report=term-missing",
|
|
69
|
+
"--cov-report=html",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
[tool.black]
|
|
73
|
+
line-length = 88
|
|
74
|
+
target-version = ['py312']
|
|
75
|
+
include = '\.pyi?$'
|
|
76
|
+
extend-exclude = '''
|
|
77
|
+
/(
|
|
78
|
+
# directories
|
|
79
|
+
\.eggs
|
|
80
|
+
| \.git
|
|
81
|
+
| \.hg
|
|
82
|
+
| \.mypy_cache
|
|
83
|
+
| \.tox
|
|
84
|
+
| \.venv
|
|
85
|
+
| build
|
|
86
|
+
| dist
|
|
87
|
+
)/
|
|
88
|
+
'''
|
|
89
|
+
|
|
90
|
+
[tool.ruff.lint.per-file-ignores]
|
|
91
|
+
"tests/*" = ["D", "S101"]
|
|
92
|
+
|
|
93
|
+
[tool.mypy]
|
|
94
|
+
python_version = "3.12"
|
|
95
|
+
warn_return_any = true
|
|
96
|
+
warn_unused_configs = true
|
|
97
|
+
disallow_untyped_defs = true
|
|
98
|
+
disallow_incomplete_defs = true
|
|
99
|
+
check_untyped_defs = true
|
|
100
|
+
disallow_untyped_decorators = true
|
|
101
|
+
no_implicit_optional = true
|
|
102
|
+
warn_redundant_casts = true
|
|
103
|
+
warn_unused_ignores = true
|
|
104
|
+
warn_no_return = true
|
|
105
|
+
warn_unreachable = true
|
|
106
|
+
strict_equality = true
|
|
107
|
+
|
|
108
|
+
[[tool.mypy.overrides]]
|
|
109
|
+
module = [
|
|
110
|
+
"boost.utils.torch.*",
|
|
111
|
+
"boost.utils.timer",
|
|
112
|
+
"boost.utils.gpu.gpu_detect",
|
|
113
|
+
"boost.utils.gpu.gpu_info",
|
|
114
|
+
"boost.scheduling.scheduler",
|
|
115
|
+
"boost.core.session.session_request",
|
|
116
|
+
]
|
|
117
|
+
ignore_errors = true
|
|
118
|
+
|
|
119
|
+
[tool.coverage.run]
|
|
120
|
+
source = ["src"]
|
|
121
|
+
omit = ["tests/*"]
|
|
122
|
+
|
|
123
|
+
[tool.coverage.report]
|
|
124
|
+
exclude_lines = [
|
|
125
|
+
"pragma: no cover",
|
|
126
|
+
"def __repr__",
|
|
127
|
+
"raise AssertionError",
|
|
128
|
+
"raise NotImplementedError",
|
|
129
|
+
"if __name__ == .__main__.:",
|
|
130
|
+
"if TYPE_CHECKING:",
|
|
131
|
+
]
|
zboost-1.0.5/setup.cfg
ADDED