Skip to content

Commit 611efc8

Browse files
committed
[ci] update ci
* test on julia 1.6 * set project correctly for submitted test script * improve output
1 parent ac02238 commit 611efc8

File tree

7 files changed

+18
-44
lines changed

7 files changed

+18
-44
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ jobs:
2626
docker exec -t slurmctld srun -n 4 hostname
2727
- name: Test SlurmClusterManager
2828
run: |
29-
docker exec -t slurmctld julia -e 'using Pkg; Pkg.build(verbose=true)'
30-
docker exec -t slurmctld julia -e 'using Pkg; Pkg.test()'
29+
docker exec -t slurmctld julia -e 'import Pkg; Pkg.activate("SlurmClusterManager"); Pkg.test()'

Manifest.toml

Lines changed: 0 additions & 33 deletions
This file was deleted.

Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ version = "0.1.0"
55

66
[deps]
77
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
8-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

ci/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ RUN mkdir -p /home/docker/.local/opt/julia \
88
ENV PATH="/home/docker/.local/opt/julia/bin:${PATH}"
99

1010
COPY --chown=docker . SlurmClusterManager
11-
ENV JULIA_PROJECT="/home/docker/SlurmClusterManager"
1211

1312
CMD /bin/bash -l

test/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[deps]
2+
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
3+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

test/runtests.jl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ using Distributed, Test, SlurmClusterManager
66
@test !(Sys.which("sinfo") === nothing)
77

88
# submit job
9-
jobid = read(`sbatch --export=ALL --parsable -n 4 -o test.out script.jl`, String)
9+
# project should point to top level dir so that SlurmClusterManager is available to script.jl
10+
project_path = abspath(joinpath(@__DIR__, ".."))
11+
println("project_path = $project_path")
12+
jobid = withenv("JULIA_PROJECT"=>project_path) do
13+
read(`sbatch --export=ALL --parsable -n 4 -o test.out script.jl`, String)
14+
end
1015
println("jobid = $jobid")
1116

1217
# get job state from jobid
@@ -24,12 +29,14 @@ end
2429
# check that job finished running within timelimit (either completed or failed)
2530
@test status == :ok
2631

32+
# print job output
33+
output = read("test.out", String)
34+
println("script output:")
35+
println(output)
36+
2737
state = getjobstate(jobid) |> split
2838
# length should be two because creating the workers creates a job step
2939
@test length(state) == 2
3040

3141
# check that everything exited without errors
3242
@test all(state .== "COMPLETED")
33-
34-
# print job output
35-
read("test.out", String) |> print

test/script.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env julia
22

3-
using Test, Distributed, SlurmClusterManager
3+
using Distributed, SlurmClusterManager
44
addprocs(SlurmManager())
55

6-
@test nworkers() == parse(Int, ENV["SLURM_NTASKS"])
6+
@assert nworkers() == parse(Int, ENV["SLURM_NTASKS"])
77

88
hosts = map(workers()) do id
99
remotecall_fetch(() -> gethostname(), id)
1010
end
1111
sort!(hosts)
1212

13-
@test hosts == ["c1", "c1", "c2", "c2"]
13+
@assert hosts == ["c1", "c1", "c2", "c2"]

0 commit comments

Comments
 (0)