<commit_before>#!/usr/bin/env bash

# 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 20s
# 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
# We restart galaxy
docker stop galaxy-slurm-test
docker rm galaxy-slurm-test
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 40s
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<commit_msg>update SLURM test<commit_after>#!/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 60s
# 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
{'fraction_non_alphanumeric': 0.0936022691459187, 'fraction_numerical': 0.012606366214938543, 'mean_word_length': 3.4957507082152977, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7106163', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1054, 'n_words': 421}