slurmate 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.
- slurmate-0.1.0/LICENSE +21 -0
- slurmate-0.1.0/PKG-INFO +246 -0
- slurmate-0.1.0/README.md +208 -0
- slurmate-0.1.0/pyproject.toml +79 -0
- slurmate-0.1.0/setup.cfg +4 -0
- slurmate-0.1.0/src/slurmate/__init__.py +3 -0
- slurmate-0.1.0/src/slurmate/builder.py +219 -0
- slurmate-0.1.0/src/slurmate/main.py +512 -0
- slurmate-0.1.0/src/slurmate/py.typed +0 -0
- slurmate-0.1.0/src/slurmate/system_utils.py +599 -0
- slurmate-0.1.0/src/slurmate/theme.py +155 -0
- slurmate-0.1.0/src/slurmate/tui.py +1125 -0
- slurmate-0.1.0/src/slurmate.egg-info/PKG-INFO +246 -0
- slurmate-0.1.0/src/slurmate.egg-info/SOURCES.txt +21 -0
- slurmate-0.1.0/src/slurmate.egg-info/dependency_links.txt +1 -0
- slurmate-0.1.0/src/slurmate.egg-info/entry_points.txt +2 -0
- slurmate-0.1.0/src/slurmate.egg-info/requires.txt +12 -0
- slurmate-0.1.0/src/slurmate.egg-info/top_level.txt +1 -0
- slurmate-0.1.0/tests/test_builder.py +267 -0
- slurmate-0.1.0/tests/test_main.py +187 -0
- slurmate-0.1.0/tests/test_parsers.py +178 -0
- slurmate-0.1.0/tests/test_system_utils.py +193 -0
- slurmate-0.1.0/tests/test_tui.py +329 -0
slurmate-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Slurmify contributors
|
|
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.
|
slurmate-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: slurmate
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Interactive TUI wizard for generating and submitting Slurm sbatch scripts
|
|
5
|
+
Author-email: Youzhi Yu <yuyouzhi666@icloud.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/PursuitOfDataScience/slurmate
|
|
8
|
+
Project-URL: Repository, https://github.com/PursuitOfDataScience/slurmate.git
|
|
9
|
+
Project-URL: Issues, https://github.com/PursuitOfDataScience/slurmate/issues
|
|
10
|
+
Keywords: slurm,sbatch,hpc,tui,wizard
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console :: Curses
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Natural Language :: English
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: questionary>=2.0
|
|
27
|
+
Requires-Dist: prompt_toolkit>=3.0
|
|
28
|
+
Requires-Dist: rich>=13.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-mock>=3.10; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff>=0.3.0; extra == "dev"
|
|
34
|
+
Requires-Dist: mypy>=1.8; extra == "dev"
|
|
35
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
36
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
<div align="center">
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
███████╗██╗ ██╗ ██╗██████╗ ███╗ ███╗ █████╗ ████████╗███████╗
|
|
43
|
+
██╔════╝██║ ██║ ██║██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██╔════╝
|
|
44
|
+
███████╗██║ ██║ ██║██████╔╝██╔████╔██║███████║ ██║ █████╗
|
|
45
|
+
╚════██║██║ ██║ ██║██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══╝
|
|
46
|
+
███████║███████╗╚██████╔╝██║ ██║██║ ╚═╝ ██║██║ ██║ ██║ ███████╗
|
|
47
|
+
╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### ⚡ Stop hand-writing `sbatch` scripts. Let the wizard do it.
|
|
51
|
+
|
|
52
|
+
A fast, friendly **TUI wizard + CLI** that builds and submits Slurm batch jobs —
|
|
53
|
+
on any cluster, as long as `sbatch` is on your `PATH`.
|
|
54
|
+
|
|
55
|
+
[](https://github.com/PursuitOfDataScience/slurmate/actions/workflows/ci.yml)
|
|
56
|
+
[](https://www.python.org/downloads/)
|
|
57
|
+
[](#-license)
|
|
58
|
+
[](#-status)
|
|
59
|
+
[](https://github.com/astral-sh/ruff)
|
|
60
|
+
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## ✨ Why Slurmate?
|
|
66
|
+
|
|
67
|
+
Writing `#SBATCH` headers by hand is fiddly and error-prone: which partition has
|
|
68
|
+
H100s? what's the memory limit? did I get the `--gres` syntax right for *this*
|
|
69
|
+
cluster? Slurmate turns that into a guided conversation — it reads your cluster
|
|
70
|
+
live, validates as you go, and hands you a clean, ready-to-submit script.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
slurmate
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
That's it. Answer a few prompts, watch the script build itself in a live
|
|
77
|
+
preview, and submit — or save it for later.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 🚀 Quick start
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Recommended: isolated install
|
|
85
|
+
pipx install slurmate
|
|
86
|
+
|
|
87
|
+
# or plain pip
|
|
88
|
+
pip install slurmate
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
<details>
|
|
92
|
+
<summary>Install from source / for development</summary>
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
git clone https://github.com/PursuitOfDataScience/slurmate.git
|
|
96
|
+
cd slurmate
|
|
97
|
+
pip install -e ".[dev]" # editable + dev tools (pytest, ruff, mypy)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
</details>
|
|
101
|
+
|
|
102
|
+
### Interactive mode (the TUI)
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
slurmate
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
A full-screen wizard walks you through name → resources → environment →
|
|
109
|
+
command. The generated script grows **live** in a preview pane as you answer,
|
|
110
|
+
and when you're done you get a single menu: **Submit · Edit · Save · Show ·
|
|
111
|
+
Quit**.
|
|
112
|
+
|
|
113
|
+
> 💡 You can leave any step blank and come back to it — anything still missing is
|
|
114
|
+
> flagged before you submit. `Esc` / `Shift+Tab` go back; `F1` opens help.
|
|
115
|
+
|
|
116
|
+
### Batch mode (scriptable, no TUI)
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
slurmate \
|
|
120
|
+
--job-name train_job \
|
|
121
|
+
--partition gpu \
|
|
122
|
+
--cpus 8 --memory 32G --time 04:00:00 \
|
|
123
|
+
--gpus 1 --gpu-type h100 \
|
|
124
|
+
--command "python train.py"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Submit immediately, no prompts:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
slurmate --partition gpu --command "python train.py" --yes
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Just want the script? Print it (great for piping or CI):
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
slurmate --partition gpu --command "python train.py" --print > job.sbatch
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Run `slurmate --help` for the full flag list.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## 🎯 Features
|
|
144
|
+
|
|
145
|
+
| | |
|
|
146
|
+
|---|---|
|
|
147
|
+
| 🧠 **Live cluster awareness** | Pulls real partitions, GPU types, QoS, accounts, conda envs, and modules from `sinfo` / `scontrol` / `sacctmgr` / `conda`. |
|
|
148
|
+
| 👀 **Live preview** | The `#SBATCH` script builds incrementally as you answer — what you see is exactly what gets submitted. |
|
|
149
|
+
| 🛡️ **Partition-aware validation** | Inline warnings when CPU / memory / time / GPU requests exceed the selected partition's limits. |
|
|
150
|
+
| 📁 **Path autocomplete** | `Tab`-complete file paths while typing your command, virtualenv path, or output files — no more retyping long project paths. |
|
|
151
|
+
| ↩️ **Skip & come back** | Leave steps blank, navigate freely with `Esc`, and get reminded of anything missing before submit. |
|
|
152
|
+
| 📋 **Copy-friendly** | Mouse capture is off by default so you can select/copy the preview natively (`F2` toggles mouse nav). |
|
|
153
|
+
| 🧩 **Cluster-agnostic GPU syntax** | Choose `--gres=gpu:type:N`, `--gres` + `--constraint`, or `--gpus` to match your site. |
|
|
154
|
+
| 🐍 **Env activation** | Conda, Mamba, virtualenv, or none — generated automatically. |
|
|
155
|
+
| 🗂️ **Smart output paths** | Set a custom log name/pattern (`%j` = job ID); error path is derived and log dirs are auto-created. |
|
|
156
|
+
| ♻️ **Reproducible** | Save the script, edit it in `$EDITOR`, or keep a copy of every submission. |
|
|
157
|
+
| 🧪 **Safe to explore** | No Slurm? It falls back to realistic mock data so you can try the whole flow anywhere. |
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## ⚙️ Configuration file
|
|
162
|
+
|
|
163
|
+
Stop retyping the same account and partition every run. Slurmate reads defaults
|
|
164
|
+
from a TOML file (first match wins):
|
|
165
|
+
|
|
166
|
+
1. `.slurmate.toml` in the current directory
|
|
167
|
+
2. `~/.config/slurmate/config.toml`
|
|
168
|
+
|
|
169
|
+
These prefill the wizard **and** act as fallbacks in batch mode. Explicit CLI
|
|
170
|
+
flags always win.
|
|
171
|
+
|
|
172
|
+
```toml
|
|
173
|
+
# .slurmate.toml — keys may be top-level or under a [defaults] table
|
|
174
|
+
account = "my_lab"
|
|
175
|
+
partition = "gpu-shared"
|
|
176
|
+
cpus = 8
|
|
177
|
+
memory = "32G"
|
|
178
|
+
time_limit = "04:00:00"
|
|
179
|
+
gpu_format = "gres_type" # gres_type | constraint | gpus
|
|
180
|
+
env_type = "conda" # conda | mamba | venv | none
|
|
181
|
+
modules = ["cuda/12.1", "gcc/9.3.0"]
|
|
182
|
+
output_dir = "logs"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Recognized keys:** `job_name`, `account`, `partition`, `qos`, `cpus`, `memory`,
|
|
186
|
+
`time_limit`, `nodes`, `ntasks_per_node`, `gpus`, `gpu_type`, `gpu_format`,
|
|
187
|
+
`array_spec`, `modules`, `env_type`, `env_name`, `output_dir`, `output_file`,
|
|
188
|
+
`command`, `custom_sbatch`.
|
|
189
|
+
|
|
190
|
+
> Real TOML is used when available (`tomllib` on 3.11+, `tomli` otherwise);
|
|
191
|
+
> without either, a minimal flat `key = value` reader is used as a fallback.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 🔧 Environment variables
|
|
196
|
+
|
|
197
|
+
| Variable | Effect |
|
|
198
|
+
|---|---|
|
|
199
|
+
| `SLURMATE_MOCK=1` | Force mock mode even when Slurm is installed (great for demos/tests). |
|
|
200
|
+
| `SLURMATE_GPU_FORMAT` | Default GPU syntax: `gres_type` (default) · `constraint` · `gpus`. |
|
|
201
|
+
| `SLURMATE_LOG_DIR=…` | Save a copy of every submitted script there for reproducibility. |
|
|
202
|
+
| `SLURMATE_NO_BANNER=1` | Hide the startup banner. |
|
|
203
|
+
| `SLURMATE_BANNER_ANIMATE=1` | Force the animated banner even when not a TTY. |
|
|
204
|
+
| `SLURMATE_DEBUG=1` | Verbose debug logging. |
|
|
205
|
+
|
|
206
|
+
`NO_COLOR` and non-TTY output are respected automatically.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 🛠️ How it works
|
|
211
|
+
|
|
212
|
+
1. **Gather** — query the cluster (or fall back to mock data) for partitions,
|
|
213
|
+
limits, GPU types, environments, and modules.
|
|
214
|
+
2. **Guide** — a keyboard-first wizard collects name, resources, dependencies,
|
|
215
|
+
and the command, validating against the chosen partition as you go.
|
|
216
|
+
3. **Generate & submit** — produce a clean `#SBATCH` script, optionally edit it
|
|
217
|
+
in `$EDITOR`, then pipe it straight to `sbatch` (or save / print it).
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 🧪 Status
|
|
222
|
+
|
|
223
|
+
Slurmate is **experimental** and pre-1.0 — the CLI, config keys, and defaults may
|
|
224
|
+
change between releases. It's already useful day-to-day; pin a version if you
|
|
225
|
+
script around it. Bug reports and cluster-specific quirks are very welcome.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 🤝 Contributing
|
|
230
|
+
|
|
231
|
+
Issues and PRs are welcome! For local development:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
pip install -e ".[dev]"
|
|
235
|
+
ruff check src/ # lint
|
|
236
|
+
mypy src/ # types (strict)
|
|
237
|
+
pytest # tests
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
CI runs the same three checks on Python 3.10–3.12 for every push and PR.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## 📄 License
|
|
245
|
+
|
|
246
|
+
Released under the [MIT License](LICENSE).
|
slurmate-0.1.0/README.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
███████╗██╗ ██╗ ██╗██████╗ ███╗ ███╗ █████╗ ████████╗███████╗
|
|
5
|
+
██╔════╝██║ ██║ ██║██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██╔════╝
|
|
6
|
+
███████╗██║ ██║ ██║██████╔╝██╔████╔██║███████║ ██║ █████╗
|
|
7
|
+
╚════██║██║ ██║ ██║██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══╝
|
|
8
|
+
███████║███████╗╚██████╔╝██║ ██║██║ ╚═╝ ██║██║ ██║ ██║ ███████╗
|
|
9
|
+
╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### ⚡ Stop hand-writing `sbatch` scripts. Let the wizard do it.
|
|
13
|
+
|
|
14
|
+
A fast, friendly **TUI wizard + CLI** that builds and submits Slurm batch jobs —
|
|
15
|
+
on any cluster, as long as `sbatch` is on your `PATH`.
|
|
16
|
+
|
|
17
|
+
[](https://github.com/PursuitOfDataScience/slurmate/actions/workflows/ci.yml)
|
|
18
|
+
[](https://www.python.org/downloads/)
|
|
19
|
+
[](#-license)
|
|
20
|
+
[](#-status)
|
|
21
|
+
[](https://github.com/astral-sh/ruff)
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## ✨ Why Slurmate?
|
|
28
|
+
|
|
29
|
+
Writing `#SBATCH` headers by hand is fiddly and error-prone: which partition has
|
|
30
|
+
H100s? what's the memory limit? did I get the `--gres` syntax right for *this*
|
|
31
|
+
cluster? Slurmate turns that into a guided conversation — it reads your cluster
|
|
32
|
+
live, validates as you go, and hands you a clean, ready-to-submit script.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
slurmate
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
That's it. Answer a few prompts, watch the script build itself in a live
|
|
39
|
+
preview, and submit — or save it for later.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 🚀 Quick start
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Recommended: isolated install
|
|
47
|
+
pipx install slurmate
|
|
48
|
+
|
|
49
|
+
# or plain pip
|
|
50
|
+
pip install slurmate
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
<details>
|
|
54
|
+
<summary>Install from source / for development</summary>
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
git clone https://github.com/PursuitOfDataScience/slurmate.git
|
|
58
|
+
cd slurmate
|
|
59
|
+
pip install -e ".[dev]" # editable + dev tools (pytest, ruff, mypy)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
</details>
|
|
63
|
+
|
|
64
|
+
### Interactive mode (the TUI)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
slurmate
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
A full-screen wizard walks you through name → resources → environment →
|
|
71
|
+
command. The generated script grows **live** in a preview pane as you answer,
|
|
72
|
+
and when you're done you get a single menu: **Submit · Edit · Save · Show ·
|
|
73
|
+
Quit**.
|
|
74
|
+
|
|
75
|
+
> 💡 You can leave any step blank and come back to it — anything still missing is
|
|
76
|
+
> flagged before you submit. `Esc` / `Shift+Tab` go back; `F1` opens help.
|
|
77
|
+
|
|
78
|
+
### Batch mode (scriptable, no TUI)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
slurmate \
|
|
82
|
+
--job-name train_job \
|
|
83
|
+
--partition gpu \
|
|
84
|
+
--cpus 8 --memory 32G --time 04:00:00 \
|
|
85
|
+
--gpus 1 --gpu-type h100 \
|
|
86
|
+
--command "python train.py"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Submit immediately, no prompts:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
slurmate --partition gpu --command "python train.py" --yes
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Just want the script? Print it (great for piping or CI):
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
slurmate --partition gpu --command "python train.py" --print > job.sbatch
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Run `slurmate --help` for the full flag list.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 🎯 Features
|
|
106
|
+
|
|
107
|
+
| | |
|
|
108
|
+
|---|---|
|
|
109
|
+
| 🧠 **Live cluster awareness** | Pulls real partitions, GPU types, QoS, accounts, conda envs, and modules from `sinfo` / `scontrol` / `sacctmgr` / `conda`. |
|
|
110
|
+
| 👀 **Live preview** | The `#SBATCH` script builds incrementally as you answer — what you see is exactly what gets submitted. |
|
|
111
|
+
| 🛡️ **Partition-aware validation** | Inline warnings when CPU / memory / time / GPU requests exceed the selected partition's limits. |
|
|
112
|
+
| 📁 **Path autocomplete** | `Tab`-complete file paths while typing your command, virtualenv path, or output files — no more retyping long project paths. |
|
|
113
|
+
| ↩️ **Skip & come back** | Leave steps blank, navigate freely with `Esc`, and get reminded of anything missing before submit. |
|
|
114
|
+
| 📋 **Copy-friendly** | Mouse capture is off by default so you can select/copy the preview natively (`F2` toggles mouse nav). |
|
|
115
|
+
| 🧩 **Cluster-agnostic GPU syntax** | Choose `--gres=gpu:type:N`, `--gres` + `--constraint`, or `--gpus` to match your site. |
|
|
116
|
+
| 🐍 **Env activation** | Conda, Mamba, virtualenv, or none — generated automatically. |
|
|
117
|
+
| 🗂️ **Smart output paths** | Set a custom log name/pattern (`%j` = job ID); error path is derived and log dirs are auto-created. |
|
|
118
|
+
| ♻️ **Reproducible** | Save the script, edit it in `$EDITOR`, or keep a copy of every submission. |
|
|
119
|
+
| 🧪 **Safe to explore** | No Slurm? It falls back to realistic mock data so you can try the whole flow anywhere. |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## ⚙️ Configuration file
|
|
124
|
+
|
|
125
|
+
Stop retyping the same account and partition every run. Slurmate reads defaults
|
|
126
|
+
from a TOML file (first match wins):
|
|
127
|
+
|
|
128
|
+
1. `.slurmate.toml` in the current directory
|
|
129
|
+
2. `~/.config/slurmate/config.toml`
|
|
130
|
+
|
|
131
|
+
These prefill the wizard **and** act as fallbacks in batch mode. Explicit CLI
|
|
132
|
+
flags always win.
|
|
133
|
+
|
|
134
|
+
```toml
|
|
135
|
+
# .slurmate.toml — keys may be top-level or under a [defaults] table
|
|
136
|
+
account = "my_lab"
|
|
137
|
+
partition = "gpu-shared"
|
|
138
|
+
cpus = 8
|
|
139
|
+
memory = "32G"
|
|
140
|
+
time_limit = "04:00:00"
|
|
141
|
+
gpu_format = "gres_type" # gres_type | constraint | gpus
|
|
142
|
+
env_type = "conda" # conda | mamba | venv | none
|
|
143
|
+
modules = ["cuda/12.1", "gcc/9.3.0"]
|
|
144
|
+
output_dir = "logs"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Recognized keys:** `job_name`, `account`, `partition`, `qos`, `cpus`, `memory`,
|
|
148
|
+
`time_limit`, `nodes`, `ntasks_per_node`, `gpus`, `gpu_type`, `gpu_format`,
|
|
149
|
+
`array_spec`, `modules`, `env_type`, `env_name`, `output_dir`, `output_file`,
|
|
150
|
+
`command`, `custom_sbatch`.
|
|
151
|
+
|
|
152
|
+
> Real TOML is used when available (`tomllib` on 3.11+, `tomli` otherwise);
|
|
153
|
+
> without either, a minimal flat `key = value` reader is used as a fallback.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 🔧 Environment variables
|
|
158
|
+
|
|
159
|
+
| Variable | Effect |
|
|
160
|
+
|---|---|
|
|
161
|
+
| `SLURMATE_MOCK=1` | Force mock mode even when Slurm is installed (great for demos/tests). |
|
|
162
|
+
| `SLURMATE_GPU_FORMAT` | Default GPU syntax: `gres_type` (default) · `constraint` · `gpus`. |
|
|
163
|
+
| `SLURMATE_LOG_DIR=…` | Save a copy of every submitted script there for reproducibility. |
|
|
164
|
+
| `SLURMATE_NO_BANNER=1` | Hide the startup banner. |
|
|
165
|
+
| `SLURMATE_BANNER_ANIMATE=1` | Force the animated banner even when not a TTY. |
|
|
166
|
+
| `SLURMATE_DEBUG=1` | Verbose debug logging. |
|
|
167
|
+
|
|
168
|
+
`NO_COLOR` and non-TTY output are respected automatically.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 🛠️ How it works
|
|
173
|
+
|
|
174
|
+
1. **Gather** — query the cluster (or fall back to mock data) for partitions,
|
|
175
|
+
limits, GPU types, environments, and modules.
|
|
176
|
+
2. **Guide** — a keyboard-first wizard collects name, resources, dependencies,
|
|
177
|
+
and the command, validating against the chosen partition as you go.
|
|
178
|
+
3. **Generate & submit** — produce a clean `#SBATCH` script, optionally edit it
|
|
179
|
+
in `$EDITOR`, then pipe it straight to `sbatch` (or save / print it).
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 🧪 Status
|
|
184
|
+
|
|
185
|
+
Slurmate is **experimental** and pre-1.0 — the CLI, config keys, and defaults may
|
|
186
|
+
change between releases. It's already useful day-to-day; pin a version if you
|
|
187
|
+
script around it. Bug reports and cluster-specific quirks are very welcome.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## 🤝 Contributing
|
|
192
|
+
|
|
193
|
+
Issues and PRs are welcome! For local development:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
pip install -e ".[dev]"
|
|
197
|
+
ruff check src/ # lint
|
|
198
|
+
mypy src/ # types (strict)
|
|
199
|
+
pytest # tests
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
CI runs the same three checks on Python 3.10–3.12 for every push and PR.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## 📄 License
|
|
207
|
+
|
|
208
|
+
Released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "slurmate"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Interactive TUI wizard for generating and submitting Slurm sbatch scripts"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Youzhi Yu", email = "yuyouzhi666@icloud.com"},
|
|
14
|
+
]
|
|
15
|
+
keywords = ["slurm", "sbatch", "hpc", "tui", "wizard"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console :: Curses",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Natural Language :: English",
|
|
22
|
+
"Operating System :: POSIX :: Linux",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Topic :: System :: Distributed Computing",
|
|
28
|
+
"Topic :: Utilities",
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"questionary>=2.0",
|
|
32
|
+
"prompt_toolkit>=3.0",
|
|
33
|
+
"rich>=13.0",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/PursuitOfDataScience/slurmate"
|
|
38
|
+
Repository = "https://github.com/PursuitOfDataScience/slurmate.git"
|
|
39
|
+
Issues = "https://github.com/PursuitOfDataScience/slurmate/issues"
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=7.0",
|
|
44
|
+
"pytest-mock>=3.10",
|
|
45
|
+
"pytest-cov>=4.0",
|
|
46
|
+
"ruff>=0.3.0",
|
|
47
|
+
"mypy>=1.8",
|
|
48
|
+
"build>=1.0",
|
|
49
|
+
"twine>=5.0",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[project.scripts]
|
|
53
|
+
slurmate = "slurmate.main:main"
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.packages.find]
|
|
56
|
+
where = ["src"]
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.package-data]
|
|
59
|
+
slurmate = ["py.typed"]
|
|
60
|
+
|
|
61
|
+
[tool.ruff]
|
|
62
|
+
target-version = "py310"
|
|
63
|
+
line-length = 100
|
|
64
|
+
|
|
65
|
+
[tool.ruff.lint]
|
|
66
|
+
select = ["E", "F", "I", "W", "UP"]
|
|
67
|
+
ignore = ["E501"]
|
|
68
|
+
|
|
69
|
+
[tool.mypy]
|
|
70
|
+
python_version = "3.10"
|
|
71
|
+
strict = true
|
|
72
|
+
ignore_missing_imports = true
|
|
73
|
+
warn_unused_configs = true
|
|
74
|
+
disallow_untyped_defs = true
|
|
75
|
+
check_untyped_defs = true
|
|
76
|
+
|
|
77
|
+
[tool.pytest.ini_options]
|
|
78
|
+
testpaths = ["tests"]
|
|
79
|
+
python_files = ["test_*.py"]
|
slurmate-0.1.0/setup.cfg
ADDED