/
test.sh
38 lines (34 loc) · 1.52 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
set -x
# Test that jobs run successfully on an external slurm cluster
# We use a temporary directory as an export dir that will hold the shared data between
# galaxy and slurm:
EXPORT=`mktemp --directory`
# We build the slurm image
docker build -t slurm .
# We fire up a slurm node (with hostname slurm)
docker run -d -v "$EXPORT":/export --name slurm \
--hostname slurm \
slurm
# We start galaxy (without the internal slurm, but with a modified job_conf.xml)
# and link it to the slurm container (so that galaxy resolves the slurm container's hostname)
docker run -d -e "NONUSE=slurmd,slurmctld" \
--link slurm --name galaxy-slurm-test -h galaxy \
-p 80:80 -v "$EXPORT":/export quay.io/bgruening/galaxy
# We wait for the creation of the /galaxy-central/config/ if it does not exist yet
sleep 180s
# We restart galaxy
docker stop galaxy-slurm-test
docker rm galaxy-slurm-test
# We copy the job_conf.xml to the $EXPORT folder
sudo cp job_conf.xml "$EXPORT"/galaxy-central/config/
sudo chown 1450:1450 "$EXPORT"/galaxy-central/config/job_conf.xml
docker run -d -e "NONUSE=slurmd,slurmctld" \
--link slurm --name galaxy-slurm-test -h galaxy \
-p 80:80 -v "$EXPORT":/export quay.io/bgruening/galaxy
# Let's submit a job from the galaxy container and check it runs in the slurm container
sleep 60s
docker exec galaxy-slurm-test su - galaxy -c 'srun hostname' | grep slurm
docker stop galaxy-slurm-test slurm
docker rm galaxy-slurm-test slurm
# TODO: Run a galaxy tool and check it runs on the cluster