Skip to content

Commit

Permalink
feat: Added use of /shared directory between Slurm-Mail containers fo…
Browse files Browse the repository at this point in the history
…r job output
  • Loading branch information
neilmunday committed May 2, 2024
1 parent 31b037b commit 4f2d25d
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 12 deletions.
3 changes: 2 additions & 1 deletion tests/integration/Dockerfile.slurm-mail.amzn2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ RUN yum install -y chrony cronie python3 && \
pip3 install pyyaml && \
mkdir -p /root/testing/output && \
sed -i "s#MailProg=/usr/bin/mailx#MailProg=/usr/bin/slurm-spool-mail#" /etc/slurm/slurm.conf && \
echo "alias ll='ls -l'" >> /root/.bashrc
echo "alias ll='ls -l'" >> /root/.bashrc && \
mkdir /shared

COPY supervisord.conf /etc/supervisord.conf

Expand Down
3 changes: 2 additions & 1 deletion tests/integration/Dockerfile.slurm-mail.amzn2023
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ RUN dnf install -y chrony cronie python3 python3-setuptools && \
pip3 install pyyaml && \
mkdir -p /root/testing/output && \
sed -i "s#MailProg=/usr/bin/mailx#MailProg=/usr/bin/slurm-spool-mail#" /etc/slurm/slurm.conf && \
echo "alias ll='ls -l'" >> /root/.bashrc
echo "alias ll='ls -l'" >> /root/.bashrc && \
mkdir /shared

COPY supervisord.conf /etc/supervisord.conf

Expand Down
3 changes: 2 additions & 1 deletion tests/integration/Dockerfile.slurm-mail.el7
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ RUN yum install -y chrony cronie python3 && \
pip3 install pyyaml && \
mkdir -p /root/testing/output && \
sed -i "s#MailProg=/usr/bin/mailx#MailProg=/usr/bin/slurm-spool-mail#" /etc/slurm/slurm.conf && \
echo "alias ll='ls -l'" >> /root/.bashrc
echo "alias ll='ls -l'" >> /root/.bashrc && \
mkdir /shared

COPY supervisord.conf /etc/supervisord.conf

Expand Down
3 changes: 2 additions & 1 deletion tests/integration/Dockerfile.slurm-mail.el8
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ RUN dnf install -y chrony cronie python36 python3-pyyaml && \
pip3 install aiosmtpd && \
mkdir -p /root/testing/output && \
sed -i "s#MailProg=/usr/bin/mailx#MailProg=/usr/bin/slurm-spool-mail#" /etc/slurm/slurm.conf && \
echo "alias ll='ls -l'" >> /root/.bashrc
echo "alias ll='ls -l'" >> /root/.bashrc && \
mkdir /shared

COPY supervisord.conf /etc/supervisord.conf

Expand Down
3 changes: 2 additions & 1 deletion tests/integration/Dockerfile.slurm-mail.el9
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ RUN dnf install -y chrony cronie python3 python3-pip python3-pyyaml && \
pip3 install aiosmtpd && \
mkdir -p /root/testing/output && \
sed -i "s#MailProg=/usr/bin/mailx#MailProg=/usr/bin/slurm-spool-mail#" /etc/slurm/slurm.conf && \
echo "alias ll='ls -l'" >> /root/.bashrc
echo "alias ll='ls -l'" >> /root/.bashrc && \
mkdir /shared

COPY supervisord.conf /etc/supervisord.conf

Expand Down
3 changes: 2 additions & 1 deletion tests/integration/Dockerfile.slurm-mail.sl15
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ RUN zypper install -y chrony cronie python3 python3-pip python3-PyYAML && \
pip3 install aiosmtpd && \
mkdir -p /root/testing/output && \
sed -i "s#MailProg=/usr/bin/mailx#MailProg=/usr/bin/slurm-spool-mail#" /etc/slurm/slurm.conf && \
echo "alias ll='ls -l'" >> /root/.bashrc
echo "alias ll='ls -l'" >> /root/.bashrc \
mkdir /shared

COPY supervisord.conf /etc/supervisord.conf

Expand Down
3 changes: 2 additions & 1 deletion tests/integration/Dockerfile.slurm-mail.ub20
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ ARG SLURM_MAIL_PKG
RUN apt-get update && apt-get install -y cron chrony logrotate python3-yaml python3-aiosmtpd && \
mkdir -p /root/testing/output && \
sed -i "s#MailProg=/usr/bin/mailx#MailProg=/usr/bin/slurm-spool-mail#" /etc/slurm/slurm.conf && \
echo "alias ll='ls -l'" >> /root/.bashrc
echo "alias ll='ls -l'" >> /root/.bashrc && \
mkdir /shared

COPY supervisord.conf /etc/supervisord.conf

Expand Down
3 changes: 2 additions & 1 deletion tests/integration/Dockerfile.slurm-mail.ub22
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ ARG SLURM_MAIL_PKG
RUN apt-get update && apt-get install -y cron chrony logrotate python3-yaml python3-aiosmtpd && \
mkdir -p /root/testing/output && \
sed -i "s#MailProg=/usr/bin/mailx#MailProg=/usr/bin/slurm-spool-mail#" /etc/slurm/slurm.conf && \
echo "alias ll='ls -l'" >> /root/.bashrc
echo "alias ll='ls -l'" >> /root/.bashrc && \
mkdir /shared

COPY supervisord.conf /etc/supervisord.conf

Expand Down
13 changes: 11 additions & 2 deletions tests/integration/compose-up-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@

set -e

function catch {
# tidy-up
docker compose -f $COMPOSE_FILE down --volumes
}

function usage {
echo "Usage: $0 -s SLURM_VERSION [-r]" 1>&2
echo " -r don't build slurm-mail RPM - use existing file"
echo " -s SLURM_VERSION version of Slurm to test against"
exit 0
}

trap 'catch $? $LINENO' EXIT

USE_RPM=0

while getopts ":s:r" options; do
Expand Down Expand Up @@ -72,5 +79,7 @@ fi
cd $DIR
RPM=`ls -1 slurm-mail*.el8.noarch.rpm`

docker compose -f docker-compose-demo.yml build --build-arg SLURM_VER=$SLURM_VER --build-arg SLURM_MAIL_PKG=$RPM
docker compose -f docker-compose-demo.yml up
COMPOSE_FILE="docker-compose-demo.yml"

docker compose -f $COMPOSE_FILE build --build-arg SLURM_VER=$SLURM_VER --build-arg SLURM_MAIL_PKG=$RPM
docker compose -f $COMPOSE_FILE up
9 changes: 9 additions & 0 deletions tests/integration/docker-compose-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ services:
- NODES=2
hostname: compute01
image: slurm-mail
volumes:
- slurm-mail-demo-shared:/shared

slurm-mail-compute:
container_name: slurm-mail-compute
environment:
Expand All @@ -21,8 +24,14 @@ services:
- NODES=2
hostname: compute02
image: slurm-mail
volumes:
- slurm-mail-demo-shared:/shared

mailhog:
container_name: mailhog
image: mailhog/mailhog
ports:
- 8025:8025 # web ui

volumes:
slurm-mail-demo-shared:
11 changes: 9 additions & 2 deletions tests/integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function catch {
function tidyup {
if [ $KEEP_CONTAINER -eq 0 ]; then
echo "stopping containers..."
docker compose -f $COMPOSE_FILE down
docker compose -f $COMPOSE_FILE down --volumes
docker image rm $NAME
echo "done"
fi
Expand Down Expand Up @@ -136,6 +136,7 @@ PKG=`ls -1 slurm-mail*${OS}*${PKG_EXT}`

TMP_DIR=`mktemp -d`
COMPOSE_FILE="${TMP_DIR}/docker-compose-tests.yml"
SHARED_VOLUME=$(echo "${NAME}-shared" | sed 's/\./_/g')

# create docker-compose file
cat << EOF > $COMPOSE_FILE
Expand All @@ -156,6 +157,8 @@ services:
- NODES=2
hostname: compute01
image: $NAME
volumes:
- ${SHARED_VOLUME}:/shared
slurm-mail-compute:
container_name: ${NAME}-compute
environment:
Expand All @@ -164,13 +167,17 @@ services:
- NODES=2
hostname: compute02
image: ghcr.io/neilmunday/slurm-mail/slurm-el8:$SLURM_VER
volumes:
- ${SHARED_VOLUME}:/shared
volumes:
${SHARED_VOLUME}:
EOF

docker compose -f $COMPOSE_FILE build
docker compose -f $COMPOSE_FILE up --detach

docker exec "${NAME}-head" /bin/bash -c \
"/root/testing/run-tests.py -i /root/testing/tests.yml -o /root/testing/output $OPTS"
"/root/testing/run-tests.py -i /root/testing/tests.yml -o /shared $OPTS"

if [ $PKG_EXT == ".rpm" ]; then
if [[ $OS == sl* ]]; then
Expand Down

0 comments on commit 4f2d25d

Please sign in to comment.