Skip to content

Commit fb89cd5

Browse files
authored
refactor: multi-version Slurm support and improved developer experience (#67)
1 parent 560d48a commit fb89cd5

27 files changed

Lines changed: 1999 additions & 298 deletions

.env

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
# Slurm git repo tag. See https://github.com/SchedMD/slurm/tags
2-
SLURM_TAG=slurm-25-05-3-1
3-
4-
# Image version used to tag the container at build time (Typically matches the
5-
# Slurm tag in semantic version form)
6-
IMAGE_TAG=25.05.3
1+
SLURM_VERSION=25.05.3

.env.example

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Slurm version (semantic version format)
2+
# Supported versions: 25.05.x, 24.11.x
3+
# This is used for:
4+
# - Downloading the Slurm tarball from schedmd.com
5+
# - Tagging the Docker image
6+
# - Selecting version-specific configuration files
7+
#
8+
# Examples:
9+
# SLURM_VERSION=25.05.3 # Latest stable (default)
10+
# SLURM_VERSION=24.11.6 # Previous stable release
11+
SLURM_VERSION=25.05.3
12+
13+
# MySQL credentials
14+
# The defaults are only suitable for local development/testing
15+
MYSQL_USER=slurm
16+
MYSQL_PASSWORD=password
17+
MYSQL_DATABASE=slurm_acct_db

.github/workflows/test.yml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Test Slurm Cluster
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch: # Allow manual trigger
9+
10+
jobs:
11+
# Build images for all supported versions
12+
build:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
strategy:
16+
matrix:
17+
slurm_version: ['25.05.3', '24.11.6']
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Build Docker image for Slurm ${{ matrix.slurm_version }}
27+
run: |
28+
echo "SLURM_VERSION=${{ matrix.slurm_version }}" > .env
29+
docker compose build
30+
31+
- name: Save Docker image
32+
run: |
33+
docker save slurm-docker-cluster:${{ matrix.slurm_version }} | gzip > slurm-${{ matrix.slurm_version }}.tar.gz
34+
35+
- name: Upload image artifact
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: slurm-image-${{ matrix.slurm_version }}
39+
path: slurm-${{ matrix.slurm_version }}.tar.gz
40+
retention-days: 1
41+
42+
# Test cluster functionality on all versions
43+
test-cluster:
44+
needs: build
45+
runs-on: ubuntu-latest
46+
timeout-minutes: 30
47+
strategy:
48+
matrix:
49+
slurm_version: ['25.05.3', '24.11.6']
50+
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v4
54+
55+
- name: Download image artifact
56+
uses: actions/download-artifact@v4
57+
with:
58+
name: slurm-image-${{ matrix.slurm_version }}
59+
60+
- name: Load Docker image
61+
run: |
62+
docker load < slurm-${{ matrix.slurm_version }}.tar.gz
63+
docker images
64+
65+
- name: Configure version
66+
run: |
67+
echo "SLURM_VERSION=${{ matrix.slurm_version }}" > .env
68+
cat .env
69+
70+
- name: Start cluster with 2 nodes
71+
run: |
72+
docker compose up -d
73+
echo "Waiting for services to start..."
74+
sleep 15
75+
76+
- name: Wait for MySQL to be healthy
77+
run: |
78+
timeout 60 bash -c 'until docker compose ps mysql | grep -q "healthy"; do
79+
echo "Waiting for MySQL..."
80+
sleep 2
81+
done'
82+
echo "MySQL is healthy"
83+
84+
- name: Wait for slurmdbd to be healthy
85+
run: |
86+
timeout 60 bash -c 'until docker compose ps slurmdbd | grep -q "healthy"; do
87+
echo "Waiting for slurmdbd..."
88+
sleep 2
89+
done'
90+
echo "slurmdbd is healthy"
91+
92+
- name: Wait for slurmctld to be healthy
93+
run: |
94+
timeout 60 bash -c 'until docker compose ps slurmctld | grep -q "healthy"; do
95+
echo "Waiting for slurmctld..."
96+
sleep 2
97+
done'
98+
echo "slurmctld is healthy"
99+
100+
- name: Wait for slurmrestd to be healthy
101+
run: |
102+
timeout 60 bash -c 'until docker compose ps slurmrestd | grep -q "healthy"; do
103+
echo "Waiting for slurmrestd..."
104+
sleep 2
105+
done'
106+
echo "slurmrestd is healthy"
107+
108+
- name: Wait for compute nodes to be healthy
109+
run: |
110+
timeout 90 bash -c 'until docker compose ps c1 | grep -q "healthy" && docker compose ps c2 | grep -q "healthy"; do
111+
echo "Waiting for compute nodes..."
112+
sleep 2
113+
done'
114+
echo "All compute nodes are healthy"
115+
echo "Waiting for cluster to auto-register with slurmdbd..."
116+
sleep 10
117+
118+
- name: Show cluster status
119+
run: |
120+
echo "=== Container Status ==="
121+
docker compose ps
122+
echo ""
123+
echo "=== Slurm Info ==="
124+
docker exec slurmctld sinfo
125+
echo ""
126+
echo "=== Node Details ==="
127+
docker exec slurmctld scontrol show nodes
128+
129+
- name: Test REST API
130+
run: |
131+
echo "=== Testing REST API via Unix Socket ==="
132+
# Auto-detect REST API version based on Slurm version
133+
if [ "${{ matrix.slurm_version }}" == "24.11.6" ]; then
134+
API_VERSION="v0.0.41"
135+
else
136+
API_VERSION="v0.0.42"
137+
fi
138+
echo "Using REST API version: $API_VERSION"
139+
140+
docker exec slurmrestd curl -s --unix-socket /var/run/slurmrestd/slurmrestd.socket \
141+
http://localhost/slurm/${API_VERSION}/ping
142+
echo ""
143+
echo "=== REST API Jobs Query ==="
144+
docker exec slurmrestd curl -s --unix-socket /var/run/slurmrestd/slurmrestd.socket \
145+
http://localhost/slurm/${API_VERSION}/jobs | head -20
146+
147+
- name: Run test suite
148+
run: chmod +x test_cluster.sh && ./test_cluster.sh
149+
150+
- name: Show logs on failure
151+
if: failure()
152+
run: |
153+
echo "=== Docker Compose Logs ==="
154+
docker compose logs
155+
echo ""
156+
echo "=== Container Status ==="
157+
docker compose ps
158+
159+
- name: Cleanup
160+
if: always()
161+
run: docker compose down -v

.gitignore

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Docker volumes and data
2+
*.log
3+
4+
# Environment files
5+
.env.local
6+
.env.*.local
7+
8+
# IDE and Editor files
9+
.vscode/
10+
.idea/
11+
*.swp
12+
*.swo
13+
*~
14+
.project
15+
.classpath
16+
.settings/
17+
*.sublime-project
18+
*.sublime-workspace
19+
20+
# OS specific files
21+
.DS_Store
22+
.DS_Store?
23+
._*
24+
.Spotlight-V100
25+
.Trashes
26+
ehthumbs.db
27+
Thumbs.db
28+
desktop.ini
29+
30+
# Temporary files
31+
*.tmp
32+
*.bak
33+
*.cache
34+
.temp/
35+
tmp/
36+
37+
# Build artifacts
38+
*.tar
39+
*.tar.gz
40+
*.zip
41+
42+
# Local testing files
43+
test-output/
44+
*.test
45+
46+
# Git
47+
*.orig
48+
*.rej
49+
50+
# Python
51+
__pycache__/
52+
*.py[cod]
53+
*$py.class
54+
*.so
55+
.Python
56+
*.egg-info/
57+
dist/
58+
build/
59+
60+
# Backup files
61+
*.backup
62+
*~
63+
64+
# Local overrides
65+
docker-compose.override.yml
66+
67+
rpmbuild/
68+
archive/
69+
.claude/

0 commit comments

Comments
 (0)