slurm-dashboard 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.
- slurm_dashboard-0.1.0/PKG-INFO +309 -0
- slurm_dashboard-0.1.0/README.md +275 -0
- slurm_dashboard-0.1.0/pyproject.toml +79 -0
- slurm_dashboard-0.1.0/setup.cfg +4 -0
- slurm_dashboard-0.1.0/slurm_dashboard/__init__.py +3 -0
- slurm_dashboard-0.1.0/slurm_dashboard/__main__.py +15 -0
- slurm_dashboard-0.1.0/slurm_dashboard/app.py +83 -0
- slurm_dashboard-0.1.0/slurm_dashboard/config.py +205 -0
- slurm_dashboard-0.1.0/slurm_dashboard/routes/__init__.py +1 -0
- slurm_dashboard-0.1.0/slurm_dashboard/routes/api.py +497 -0
- slurm_dashboard-0.1.0/slurm_dashboard/routes/sse.py +55 -0
- slurm_dashboard-0.1.0/slurm_dashboard/services/__init__.py +1 -0
- slurm_dashboard-0.1.0/slurm_dashboard/services/logs.py +219 -0
- slurm_dashboard-0.1.0/slurm_dashboard/services/slurm.py +2125 -0
- slurm_dashboard-0.1.0/slurm_dashboard/static/css/style.css +5770 -0
- slurm_dashboard-0.1.0/slurm_dashboard/static/js/dashboard.js +4677 -0
- slurm_dashboard-0.1.0/slurm_dashboard/templates/index.html +558 -0
- slurm_dashboard-0.1.0/slurm_dashboard/utils/__init__.py +1 -0
- slurm_dashboard-0.1.0/slurm_dashboard.egg-info/PKG-INFO +309 -0
- slurm_dashboard-0.1.0/slurm_dashboard.egg-info/SOURCES.txt +22 -0
- slurm_dashboard-0.1.0/slurm_dashboard.egg-info/dependency_links.txt +1 -0
- slurm_dashboard-0.1.0/slurm_dashboard.egg-info/entry_points.txt +2 -0
- slurm_dashboard-0.1.0/slurm_dashboard.egg-info/requires.txt +7 -0
- slurm_dashboard-0.1.0/slurm_dashboard.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: slurm-dashboard
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A lightweight web dashboard for monitoring Slurm HPC jobs
|
|
5
|
+
Author: Johannes Roth
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/andropar/slurmboard
|
|
8
|
+
Project-URL: Repository, https://github.com/andropar/slurmboard
|
|
9
|
+
Project-URL: Issues, https://github.com/andropar/slurmboard/issues
|
|
10
|
+
Keywords: slurm,hpc,dashboard,monitoring,jobs
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Web Environment
|
|
13
|
+
Classifier: Framework :: Flask
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Topic :: System :: Monitoring
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering
|
|
26
|
+
Requires-Python: >=3.8
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
Requires-Dist: flask>=2.0.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
34
|
+
|
|
35
|
+
# Slurm Dashboard
|
|
36
|
+
|
|
37
|
+
A lightweight, real-time web dashboard for monitoring Slurm HPC cluster jobs. View logs, track resource usage, analyze job patterns, and manage your workloads from a clean, modern interface.
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- **Real-time job monitoring** - Live log streaming with auto-refresh
|
|
44
|
+
- **Multiple views** - Table, Timeline, Pipeline DAG, Heatmap, and Insights
|
|
45
|
+
- **Job management** - Submit, cancel, and resubmit jobs with templates
|
|
46
|
+
- **Smart log analysis** - Automatic error detection and highlighting
|
|
47
|
+
- **Resource tracking** - CPU/GPU hours, memory efficiency, partition health
|
|
48
|
+
- **Analytics dashboard** - Job patterns, peak hours, failure analysis
|
|
49
|
+
- **Batch operations** - Select multiple jobs for cancel/resubmit/export
|
|
50
|
+
- **Dark mode** - Easy on the eyes during those late-night debugging sessions
|
|
51
|
+
|
|
52
|
+
## Screenshots
|
|
53
|
+
|
|
54
|
+
<table>
|
|
55
|
+
<tr>
|
|
56
|
+
<td width="50%">
|
|
57
|
+
|
|
58
|
+
**Job List & Logs**
|
|
59
|
+

|
|
60
|
+
|
|
61
|
+
</td>
|
|
62
|
+
<td width="50%">
|
|
63
|
+
|
|
64
|
+
**Insights Dashboard**
|
|
65
|
+

|
|
66
|
+
|
|
67
|
+
</td>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
70
|
+
<td width="50%">
|
|
71
|
+
|
|
72
|
+
**Heatmap View**
|
|
73
|
+

|
|
74
|
+
|
|
75
|
+
</td>
|
|
76
|
+
<td width="50%">
|
|
77
|
+
|
|
78
|
+
</td>
|
|
79
|
+
</tr>
|
|
80
|
+
</table>
|
|
81
|
+
|
|
82
|
+
## Installation
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install -e .
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Requirements
|
|
89
|
+
|
|
90
|
+
- Python 3.8+
|
|
91
|
+
- Access to Slurm commands (`squeue`, `sacct`, `scancel`, `sbatch`)
|
|
92
|
+
- A web browser
|
|
93
|
+
|
|
94
|
+
## Quick Start
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Basic usage - uses current user and default log location
|
|
98
|
+
slurm-dashboard
|
|
99
|
+
|
|
100
|
+
# Specify log directory
|
|
101
|
+
slurm-dashboard --log-root /path/to/your/logs
|
|
102
|
+
|
|
103
|
+
# Full options
|
|
104
|
+
slurm-dashboard --log-root ~/slurm-logs --user myusername --port 8080
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Then open `http://localhost:5000` in your browser.
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
### Command Line Options
|
|
112
|
+
|
|
113
|
+
| Option | Default | Description |
|
|
114
|
+
|--------|---------|-------------|
|
|
115
|
+
| `--host` | `127.0.0.1` | Host to bind to |
|
|
116
|
+
| `--port` | `5000` | Port to bind to |
|
|
117
|
+
| `--log-root` | `~/slurm-logs` | Root directory for Slurm log files |
|
|
118
|
+
| `--log-pattern` | `{name}/job.{stream}.{id}` | Log file path pattern |
|
|
119
|
+
| `--user` | Current user | Slurm username to filter jobs |
|
|
120
|
+
| `--refresh-cache` | `20` | Cache refresh interval in seconds |
|
|
121
|
+
|
|
122
|
+
### Log File Patterns
|
|
123
|
+
|
|
124
|
+
The dashboard needs to know where your job logs are stored and how they're named. Use `--log-pattern` to match your cluster's configuration.
|
|
125
|
+
|
|
126
|
+
**Pattern variables:**
|
|
127
|
+
- `{name}` - Job name (from `--job-name` or script name)
|
|
128
|
+
- `{id}` - Slurm job ID
|
|
129
|
+
- `{stream}` - `out` for stdout, `err` for stderr
|
|
130
|
+
|
|
131
|
+
#### Common Cluster Configurations
|
|
132
|
+
|
|
133
|
+
**Default Slurm (flat directory):**
|
|
134
|
+
```bash
|
|
135
|
+
# Logs like: /home/user/slurm-12345.out, slurm-12345.err
|
|
136
|
+
slurm-dashboard --log-root ~ --log-pattern "slurm-{id}.{stream}"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Subdirectory per job name (default):**
|
|
140
|
+
```bash
|
|
141
|
+
# Logs like: ~/slurm-logs/train_model/job.out.12345
|
|
142
|
+
slurm-dashboard --log-root ~/slurm-logs --log-pattern "{name}/job.{stream}.{id}"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Nested by job ID:**
|
|
146
|
+
```bash
|
|
147
|
+
# Logs like: ~/logs/experiment/12345/stdout, ~/logs/experiment/12345/stderr
|
|
148
|
+
slurm-dashboard --log-root ~/logs --log-pattern "{name}/{id}/std{stream}"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Project-based structure:**
|
|
152
|
+
```bash
|
|
153
|
+
# Logs like: /scratch/myproject/logs/job_12345.out
|
|
154
|
+
slurm-dashboard --log-root /scratch/myproject/logs --log-pattern "job_{id}.{stream}"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Date-based directories (use wildcards in log-root):**
|
|
158
|
+
```bash
|
|
159
|
+
# For logs like: ~/logs/2024-01/train_12345.out
|
|
160
|
+
# Run from within the date directory or use a symlink
|
|
161
|
+
slurm-dashboard --log-root ~/logs/2024-01 --log-pattern "{name}_{id}.{stream}"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Setting Up Your Slurm Scripts
|
|
165
|
+
|
|
166
|
+
To work with the dashboard, configure your Slurm scripts to write logs to a consistent location:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
#!/bin/bash
|
|
170
|
+
#SBATCH --job-name=train_model
|
|
171
|
+
#SBATCH --output=/home/%u/slurm-logs/%x/job.out.%j
|
|
172
|
+
#SBATCH --error=/home/%u/slurm-logs/%x/job.err.%j
|
|
173
|
+
|
|
174
|
+
# Your job commands here
|
|
175
|
+
python train.py
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Slurm filename variables:**
|
|
179
|
+
- `%u` - Username
|
|
180
|
+
- `%x` - Job name
|
|
181
|
+
- `%j` - Job ID
|
|
182
|
+
- `%A` - Array job ID
|
|
183
|
+
- `%a` - Array task ID
|
|
184
|
+
|
|
185
|
+
### Array Jobs
|
|
186
|
+
|
|
187
|
+
For array jobs, you might want to include the array task ID:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
#SBATCH --output=/home/%u/slurm-logs/%x/job.out.%A_%a
|
|
191
|
+
#SBATCH --error=/home/%u/slurm-logs/%x/job.err.%A_%a
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Then use:
|
|
195
|
+
```bash
|
|
196
|
+
slurm-dashboard --log-pattern "{name}/job.{stream}.{id}"
|
|
197
|
+
# The dashboard handles array job IDs like 12345_0, 12345_1 automatically
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Running on a Cluster
|
|
201
|
+
|
|
202
|
+
### SSH Tunnel (Recommended)
|
|
203
|
+
|
|
204
|
+
If you're running the dashboard on a login node:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# On the cluster
|
|
208
|
+
slurm-dashboard --port 5000
|
|
209
|
+
|
|
210
|
+
# On your local machine (in another terminal)
|
|
211
|
+
ssh -L 5000:localhost:5000 user@cluster.example.com
|
|
212
|
+
|
|
213
|
+
# Then open http://localhost:5000 in your browser
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Binding to All Interfaces
|
|
217
|
+
|
|
218
|
+
To access from other machines on the same network (less secure):
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
slurm-dashboard --host 0.0.0.0 --port 5000
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Note:** Only do this on trusted networks. The dashboard can cancel and submit jobs.
|
|
225
|
+
|
|
226
|
+
### Running in Background
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# Using nohup
|
|
230
|
+
nohup slurm-dashboard --log-root ~/slurm-logs > dashboard.log 2>&1 &
|
|
231
|
+
|
|
232
|
+
# Using screen
|
|
233
|
+
screen -S dashboard
|
|
234
|
+
slurm-dashboard --log-root ~/slurm-logs
|
|
235
|
+
# Ctrl+A, D to detach
|
|
236
|
+
|
|
237
|
+
# Using tmux
|
|
238
|
+
tmux new -s dashboard
|
|
239
|
+
slurm-dashboard --log-root ~/slurm-logs
|
|
240
|
+
# Ctrl+B, D to detach
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Views
|
|
244
|
+
|
|
245
|
+
### Table View (Default)
|
|
246
|
+
- Running jobs with real-time status
|
|
247
|
+
- Recent jobs with expandable details
|
|
248
|
+
- Click any job to view its logs
|
|
249
|
+
- Quick filters for state, partition, GPU usage
|
|
250
|
+
|
|
251
|
+
### Timeline View
|
|
252
|
+
- Gantt-style visualization of job history
|
|
253
|
+
- See job overlaps and gaps
|
|
254
|
+
- Filter by state or job name
|
|
255
|
+
- Zoom in/out for different time scales
|
|
256
|
+
|
|
257
|
+
### Pipeline View
|
|
258
|
+
- DAG visualization of job dependencies
|
|
259
|
+
- Track pipeline progress
|
|
260
|
+
- See which jobs are blocking others
|
|
261
|
+
|
|
262
|
+
### Heatmap View
|
|
263
|
+
- GitHub-style activity calendar
|
|
264
|
+
- Hourly submission patterns
|
|
265
|
+
- Success/failure rate visualization
|
|
266
|
+
|
|
267
|
+
### Insights View
|
|
268
|
+
- Efficiency score (A-F grade)
|
|
269
|
+
- Resource usage metrics (CPU/GPU hours)
|
|
270
|
+
- Memory and time limit recommendations
|
|
271
|
+
- Failure pattern detection
|
|
272
|
+
- Peak hours analysis
|
|
273
|
+
- Top job types
|
|
274
|
+
|
|
275
|
+
## Troubleshooting
|
|
276
|
+
|
|
277
|
+
### "No recent logs found"
|
|
278
|
+
- Check that `--log-root` points to the correct directory
|
|
279
|
+
- Verify `--log-pattern` matches your log file naming
|
|
280
|
+
- Ensure log files exist and are readable
|
|
281
|
+
|
|
282
|
+
### "sacct: command not found"
|
|
283
|
+
- The dashboard requires Slurm commands to be in your PATH
|
|
284
|
+
- Make sure you're running on a node with Slurm client tools installed
|
|
285
|
+
|
|
286
|
+
### Jobs not showing up
|
|
287
|
+
- Check that `--user` matches the username used when submitting jobs
|
|
288
|
+
- Verify jobs are in sacct history: `sacct -u $USER --starttime=now-7days`
|
|
289
|
+
|
|
290
|
+
### Log streaming not working
|
|
291
|
+
- Ensure the log files are accessible from the node running the dashboard
|
|
292
|
+
- Check file permissions on the log directory
|
|
293
|
+
|
|
294
|
+
## Development
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Install in development mode
|
|
298
|
+
pip install -e ".[dev]"
|
|
299
|
+
|
|
300
|
+
# Run with debug mode
|
|
301
|
+
FLASK_DEBUG=1 slurm-dashboard
|
|
302
|
+
|
|
303
|
+
# Run tests
|
|
304
|
+
pytest
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## License
|
|
308
|
+
|
|
309
|
+
MIT
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# Slurm Dashboard
|
|
2
|
+
|
|
3
|
+
A lightweight, real-time web dashboard for monitoring Slurm HPC cluster jobs. View logs, track resource usage, analyze job patterns, and manage your workloads from a clean, modern interface.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Real-time job monitoring** - Live log streaming with auto-refresh
|
|
10
|
+
- **Multiple views** - Table, Timeline, Pipeline DAG, Heatmap, and Insights
|
|
11
|
+
- **Job management** - Submit, cancel, and resubmit jobs with templates
|
|
12
|
+
- **Smart log analysis** - Automatic error detection and highlighting
|
|
13
|
+
- **Resource tracking** - CPU/GPU hours, memory efficiency, partition health
|
|
14
|
+
- **Analytics dashboard** - Job patterns, peak hours, failure analysis
|
|
15
|
+
- **Batch operations** - Select multiple jobs for cancel/resubmit/export
|
|
16
|
+
- **Dark mode** - Easy on the eyes during those late-night debugging sessions
|
|
17
|
+
|
|
18
|
+
## Screenshots
|
|
19
|
+
|
|
20
|
+
<table>
|
|
21
|
+
<tr>
|
|
22
|
+
<td width="50%">
|
|
23
|
+
|
|
24
|
+
**Job List & Logs**
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
</td>
|
|
28
|
+
<td width="50%">
|
|
29
|
+
|
|
30
|
+
**Insights Dashboard**
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
</td>
|
|
34
|
+
</tr>
|
|
35
|
+
<tr>
|
|
36
|
+
<td width="50%">
|
|
37
|
+
|
|
38
|
+
**Heatmap View**
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
</td>
|
|
42
|
+
<td width="50%">
|
|
43
|
+
|
|
44
|
+
</td>
|
|
45
|
+
</tr>
|
|
46
|
+
</table>
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install -e .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Requirements
|
|
55
|
+
|
|
56
|
+
- Python 3.8+
|
|
57
|
+
- Access to Slurm commands (`squeue`, `sacct`, `scancel`, `sbatch`)
|
|
58
|
+
- A web browser
|
|
59
|
+
|
|
60
|
+
## Quick Start
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Basic usage - uses current user and default log location
|
|
64
|
+
slurm-dashboard
|
|
65
|
+
|
|
66
|
+
# Specify log directory
|
|
67
|
+
slurm-dashboard --log-root /path/to/your/logs
|
|
68
|
+
|
|
69
|
+
# Full options
|
|
70
|
+
slurm-dashboard --log-root ~/slurm-logs --user myusername --port 8080
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Then open `http://localhost:5000` in your browser.
|
|
74
|
+
|
|
75
|
+
## Configuration
|
|
76
|
+
|
|
77
|
+
### Command Line Options
|
|
78
|
+
|
|
79
|
+
| Option | Default | Description |
|
|
80
|
+
|--------|---------|-------------|
|
|
81
|
+
| `--host` | `127.0.0.1` | Host to bind to |
|
|
82
|
+
| `--port` | `5000` | Port to bind to |
|
|
83
|
+
| `--log-root` | `~/slurm-logs` | Root directory for Slurm log files |
|
|
84
|
+
| `--log-pattern` | `{name}/job.{stream}.{id}` | Log file path pattern |
|
|
85
|
+
| `--user` | Current user | Slurm username to filter jobs |
|
|
86
|
+
| `--refresh-cache` | `20` | Cache refresh interval in seconds |
|
|
87
|
+
|
|
88
|
+
### Log File Patterns
|
|
89
|
+
|
|
90
|
+
The dashboard needs to know where your job logs are stored and how they're named. Use `--log-pattern` to match your cluster's configuration.
|
|
91
|
+
|
|
92
|
+
**Pattern variables:**
|
|
93
|
+
- `{name}` - Job name (from `--job-name` or script name)
|
|
94
|
+
- `{id}` - Slurm job ID
|
|
95
|
+
- `{stream}` - `out` for stdout, `err` for stderr
|
|
96
|
+
|
|
97
|
+
#### Common Cluster Configurations
|
|
98
|
+
|
|
99
|
+
**Default Slurm (flat directory):**
|
|
100
|
+
```bash
|
|
101
|
+
# Logs like: /home/user/slurm-12345.out, slurm-12345.err
|
|
102
|
+
slurm-dashboard --log-root ~ --log-pattern "slurm-{id}.{stream}"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Subdirectory per job name (default):**
|
|
106
|
+
```bash
|
|
107
|
+
# Logs like: ~/slurm-logs/train_model/job.out.12345
|
|
108
|
+
slurm-dashboard --log-root ~/slurm-logs --log-pattern "{name}/job.{stream}.{id}"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Nested by job ID:**
|
|
112
|
+
```bash
|
|
113
|
+
# Logs like: ~/logs/experiment/12345/stdout, ~/logs/experiment/12345/stderr
|
|
114
|
+
slurm-dashboard --log-root ~/logs --log-pattern "{name}/{id}/std{stream}"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Project-based structure:**
|
|
118
|
+
```bash
|
|
119
|
+
# Logs like: /scratch/myproject/logs/job_12345.out
|
|
120
|
+
slurm-dashboard --log-root /scratch/myproject/logs --log-pattern "job_{id}.{stream}"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Date-based directories (use wildcards in log-root):**
|
|
124
|
+
```bash
|
|
125
|
+
# For logs like: ~/logs/2024-01/train_12345.out
|
|
126
|
+
# Run from within the date directory or use a symlink
|
|
127
|
+
slurm-dashboard --log-root ~/logs/2024-01 --log-pattern "{name}_{id}.{stream}"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Setting Up Your Slurm Scripts
|
|
131
|
+
|
|
132
|
+
To work with the dashboard, configure your Slurm scripts to write logs to a consistent location:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
#!/bin/bash
|
|
136
|
+
#SBATCH --job-name=train_model
|
|
137
|
+
#SBATCH --output=/home/%u/slurm-logs/%x/job.out.%j
|
|
138
|
+
#SBATCH --error=/home/%u/slurm-logs/%x/job.err.%j
|
|
139
|
+
|
|
140
|
+
# Your job commands here
|
|
141
|
+
python train.py
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Slurm filename variables:**
|
|
145
|
+
- `%u` - Username
|
|
146
|
+
- `%x` - Job name
|
|
147
|
+
- `%j` - Job ID
|
|
148
|
+
- `%A` - Array job ID
|
|
149
|
+
- `%a` - Array task ID
|
|
150
|
+
|
|
151
|
+
### Array Jobs
|
|
152
|
+
|
|
153
|
+
For array jobs, you might want to include the array task ID:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
#SBATCH --output=/home/%u/slurm-logs/%x/job.out.%A_%a
|
|
157
|
+
#SBATCH --error=/home/%u/slurm-logs/%x/job.err.%A_%a
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Then use:
|
|
161
|
+
```bash
|
|
162
|
+
slurm-dashboard --log-pattern "{name}/job.{stream}.{id}"
|
|
163
|
+
# The dashboard handles array job IDs like 12345_0, 12345_1 automatically
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Running on a Cluster
|
|
167
|
+
|
|
168
|
+
### SSH Tunnel (Recommended)
|
|
169
|
+
|
|
170
|
+
If you're running the dashboard on a login node:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# On the cluster
|
|
174
|
+
slurm-dashboard --port 5000
|
|
175
|
+
|
|
176
|
+
# On your local machine (in another terminal)
|
|
177
|
+
ssh -L 5000:localhost:5000 user@cluster.example.com
|
|
178
|
+
|
|
179
|
+
# Then open http://localhost:5000 in your browser
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Binding to All Interfaces
|
|
183
|
+
|
|
184
|
+
To access from other machines on the same network (less secure):
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
slurm-dashboard --host 0.0.0.0 --port 5000
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Note:** Only do this on trusted networks. The dashboard can cancel and submit jobs.
|
|
191
|
+
|
|
192
|
+
### Running in Background
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Using nohup
|
|
196
|
+
nohup slurm-dashboard --log-root ~/slurm-logs > dashboard.log 2>&1 &
|
|
197
|
+
|
|
198
|
+
# Using screen
|
|
199
|
+
screen -S dashboard
|
|
200
|
+
slurm-dashboard --log-root ~/slurm-logs
|
|
201
|
+
# Ctrl+A, D to detach
|
|
202
|
+
|
|
203
|
+
# Using tmux
|
|
204
|
+
tmux new -s dashboard
|
|
205
|
+
slurm-dashboard --log-root ~/slurm-logs
|
|
206
|
+
# Ctrl+B, D to detach
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Views
|
|
210
|
+
|
|
211
|
+
### Table View (Default)
|
|
212
|
+
- Running jobs with real-time status
|
|
213
|
+
- Recent jobs with expandable details
|
|
214
|
+
- Click any job to view its logs
|
|
215
|
+
- Quick filters for state, partition, GPU usage
|
|
216
|
+
|
|
217
|
+
### Timeline View
|
|
218
|
+
- Gantt-style visualization of job history
|
|
219
|
+
- See job overlaps and gaps
|
|
220
|
+
- Filter by state or job name
|
|
221
|
+
- Zoom in/out for different time scales
|
|
222
|
+
|
|
223
|
+
### Pipeline View
|
|
224
|
+
- DAG visualization of job dependencies
|
|
225
|
+
- Track pipeline progress
|
|
226
|
+
- See which jobs are blocking others
|
|
227
|
+
|
|
228
|
+
### Heatmap View
|
|
229
|
+
- GitHub-style activity calendar
|
|
230
|
+
- Hourly submission patterns
|
|
231
|
+
- Success/failure rate visualization
|
|
232
|
+
|
|
233
|
+
### Insights View
|
|
234
|
+
- Efficiency score (A-F grade)
|
|
235
|
+
- Resource usage metrics (CPU/GPU hours)
|
|
236
|
+
- Memory and time limit recommendations
|
|
237
|
+
- Failure pattern detection
|
|
238
|
+
- Peak hours analysis
|
|
239
|
+
- Top job types
|
|
240
|
+
|
|
241
|
+
## Troubleshooting
|
|
242
|
+
|
|
243
|
+
### "No recent logs found"
|
|
244
|
+
- Check that `--log-root` points to the correct directory
|
|
245
|
+
- Verify `--log-pattern` matches your log file naming
|
|
246
|
+
- Ensure log files exist and are readable
|
|
247
|
+
|
|
248
|
+
### "sacct: command not found"
|
|
249
|
+
- The dashboard requires Slurm commands to be in your PATH
|
|
250
|
+
- Make sure you're running on a node with Slurm client tools installed
|
|
251
|
+
|
|
252
|
+
### Jobs not showing up
|
|
253
|
+
- Check that `--user` matches the username used when submitting jobs
|
|
254
|
+
- Verify jobs are in sacct history: `sacct -u $USER --starttime=now-7days`
|
|
255
|
+
|
|
256
|
+
### Log streaming not working
|
|
257
|
+
- Ensure the log files are accessible from the node running the dashboard
|
|
258
|
+
- Check file permissions on the log directory
|
|
259
|
+
|
|
260
|
+
## Development
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Install in development mode
|
|
264
|
+
pip install -e ".[dev]"
|
|
265
|
+
|
|
266
|
+
# Run with debug mode
|
|
267
|
+
FLASK_DEBUG=1 slurm-dashboard
|
|
268
|
+
|
|
269
|
+
# Run tests
|
|
270
|
+
pytest
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## License
|
|
274
|
+
|
|
275
|
+
MIT
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "slurm-dashboard"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A lightweight web dashboard for monitoring Slurm HPC jobs"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Johannes Roth"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["slurm", "hpc", "dashboard", "monitoring", "jobs"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Web Environment",
|
|
19
|
+
"Framework :: Flask",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"Intended Audience :: System Administrators",
|
|
22
|
+
"License :: OSI Approved :: MIT License",
|
|
23
|
+
"Operating System :: POSIX :: Linux",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.8",
|
|
26
|
+
"Programming Language :: Python :: 3.9",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Topic :: System :: Monitoring",
|
|
31
|
+
"Topic :: Scientific/Engineering",
|
|
32
|
+
]
|
|
33
|
+
dependencies = [
|
|
34
|
+
"flask>=2.0.0",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
dev = [
|
|
39
|
+
"pytest>=7.0.0",
|
|
40
|
+
"pytest-cov>=4.0.0",
|
|
41
|
+
"ruff>=0.1.0",
|
|
42
|
+
"mypy>=1.0.0",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
slurm-dashboard = "slurm_dashboard.__main__:main"
|
|
47
|
+
|
|
48
|
+
[project.urls]
|
|
49
|
+
Homepage = "https://github.com/andropar/slurmboard"
|
|
50
|
+
Repository = "https://github.com/andropar/slurmboard"
|
|
51
|
+
Issues = "https://github.com/andropar/slurmboard/issues"
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.packages.find]
|
|
54
|
+
where = ["."]
|
|
55
|
+
include = ["slurm_dashboard*"]
|
|
56
|
+
|
|
57
|
+
[tool.setuptools.package-data]
|
|
58
|
+
slurm_dashboard = [
|
|
59
|
+
"templates/*.html",
|
|
60
|
+
"static/css/*.css",
|
|
61
|
+
"static/js/*.js",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[tool.ruff]
|
|
65
|
+
line-length = 100
|
|
66
|
+
target-version = "py310"
|
|
67
|
+
|
|
68
|
+
[tool.ruff.lint]
|
|
69
|
+
select = ["E", "F", "I", "N", "W", "UP"]
|
|
70
|
+
|
|
71
|
+
[tool.mypy]
|
|
72
|
+
python_version = "3.10"
|
|
73
|
+
warn_return_any = true
|
|
74
|
+
warn_unused_configs = true
|
|
75
|
+
disallow_untyped_defs = true
|
|
76
|
+
|
|
77
|
+
[tool.pytest.ini_options]
|
|
78
|
+
testpaths = ["tests"]
|
|
79
|
+
python_files = ["test_*.py"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Entry point for running slurm_dashboard as a module."""
|
|
2
|
+
|
|
3
|
+
from slurm_dashboard.app import run_app
|
|
4
|
+
from slurm_dashboard.config import Config, parse_args
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def main() -> None:
|
|
8
|
+
"""Main entry point."""
|
|
9
|
+
args = parse_args()
|
|
10
|
+
config = Config.from_args(args)
|
|
11
|
+
run_app(config)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
main()
|