Skip to content

Add Slurm Docker tests #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/UnitTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Unit Tests

on:
pull_request:

push:
branches:
- master

jobs:
test-slurm:
timeout-minutes: 20
strategy:
matrix:
os: [ubuntu-latest]
julia_version: ["1.5", "nightly"]
julia_arch: [x64]
fail-fast: false

runs-on: ${{ matrix.os }}

env:
SLURM: "latest"

steps:
- name: Checkout
uses: actions/[email protected]

- uses: julia-actions/setup-julia@latest
with:
arch: ${{ matrix.julia_arch }}
version: ${{ matrix.julia_version }}

- name: Start Slurm Docker image
run: |
docker pull giovtorres/docker-centos7-slurm:$SLURM
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

- name: Instantiate package
run: docker exec slurm-$SLURM /julia/bin/julia --project=/SlurmTools -e 'using Pkg; Pkg.instantiate(verbose=true); Pkg.build(verbose=true)'

- name: Run tests without allocation
run: docker exec slurm-$SLURM /julia/bin/julia --project=/SlurmTools -e 'using Pkg; Pkg.test(test_args=["slurm"])'

- name: Run tests inside allocation
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"])'

- name: Run tests inside sbatch
run: |
cat << EOF > sbatch.sh
#!/bin/bash
#SBATCH --ntasks=2
#SBATCH --time=00:10:00
/julia/bin/julia --project=/SlurmTools -e 'using Pkg; Pkg.test(test_args=["slurm"])'
EOF
docker exec slurm-$SLURM sbatch --wait --output=/SlurmTools/output --error=/SlurmTools/output /SlurmTools/sbatch.sh
cat output
13 changes: 13 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ using Distributed
wait(rmprocs(workers()))
end

if "slurm" in ARGS
@testset "Slurm" begin
p = addprocs_slurm(1)
@test nprocs() == 2
@test workers() == p
@test fetch(@spawnat :any myid()) == p[1]
@test remotecall_fetch(+,p[1],1,1) == 2
rmprocs(p)
@test nprocs() == 1
@test workers() == [1]
end
end

@static if Sys.iswindows()
windows_which(command) = `powershell.exe -Command Get-Command $command`
is_lsf_installed() = success(windows_which("bsub.exe"))
Expand Down