Skip to content

Commit b520580

Browse files
authored
Add Slurm Docker tests (#154)
* Add Slurm Docker tests Start on #105, alternative to #125 Uses container from https://github.com/giovtorres/docker-centos7-slurm * test more combinations * sbatch output
1 parent ed7ee82 commit b520580

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/workflows/UnitTests.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Unit Tests
2+
3+
on:
4+
pull_request:
5+
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
test-slurm:
12+
timeout-minutes: 20
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
julia_version: ["1.5", "nightly"]
17+
julia_arch: [x64]
18+
fail-fast: false
19+
20+
runs-on: ${{ matrix.os }}
21+
22+
env:
23+
SLURM: "latest"
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/[email protected]
28+
29+
- uses: julia-actions/setup-julia@latest
30+
with:
31+
arch: ${{ matrix.julia_arch }}
32+
version: ${{ matrix.julia_version }}
33+
34+
- name: Start Slurm Docker image
35+
run: |
36+
docker pull giovtorres/docker-centos7-slurm:$SLURM
37+
docker run -d -it -h ernie -v $(pwd):/SlurmTools -v $(julia -e 'print(dirname(Sys.BINDIR))'):/julia --name slurm-$SLURM giovtorres/docker-centos7-slurm:$SLURM
38+
39+
- name: Instantiate package
40+
run: docker exec slurm-$SLURM /julia/bin/julia --project=/SlurmTools -e 'using Pkg; Pkg.instantiate(verbose=true); Pkg.build(verbose=true)'
41+
42+
- name: Run tests without allocation
43+
run: docker exec slurm-$SLURM /julia/bin/julia --project=/SlurmTools -e 'using Pkg; Pkg.test(test_args=["slurm"])'
44+
45+
- name: Run tests inside allocation
46+
run: docker exec slurm-$SLURM salloc -t 00:10:00 -n 2 /julia/bin/julia --project=/SlurmTools -e 'using Pkg; Pkg.test(test_args=["slurm"])'
47+
48+
- name: Run tests inside sbatch
49+
run: |
50+
cat << EOF > sbatch.sh
51+
#!/bin/bash
52+
#SBATCH --ntasks=2
53+
#SBATCH --time=00:10:00
54+
/julia/bin/julia --project=/SlurmTools -e 'using Pkg; Pkg.test(test_args=["slurm"])'
55+
EOF
56+
docker exec slurm-$SLURM sbatch --wait --output=/SlurmTools/output --error=/SlurmTools/output /SlurmTools/sbatch.sh
57+
cat output

test/runtests.jl

+13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ using Distributed
1818
wait(rmprocs(workers()))
1919
end
2020

21+
if "slurm" in ARGS
22+
@testset "Slurm" begin
23+
p = addprocs_slurm(1)
24+
@test nprocs() == 2
25+
@test workers() == p
26+
@test fetch(@spawnat :any myid()) == p[1]
27+
@test remotecall_fetch(+,p[1],1,1) == 2
28+
rmprocs(p)
29+
@test nprocs() == 1
30+
@test workers() == [1]
31+
end
32+
end
33+
2134
@static if Sys.iswindows()
2235
windows_which(command) = `powershell.exe -Command Get-Command $command`
2336
is_lsf_installed() = success(windows_which("bsub.exe"))

0 commit comments

Comments
 (0)