-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from guillaumeeb/pbs_docker_ci
Pbs docker ci
- Loading branch information
Showing
13 changed files
with
222 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
|
||
function jobqueue_before_install { | ||
docker version | ||
docker-compose version | ||
|
||
# start pbs cluster | ||
cd ./ci/pbs | ||
./start-pbs.sh | ||
cd - | ||
|
||
docker exec -it -u pbsuser pbs_master pbsnodes -a | ||
docker ps -a | ||
docker images | ||
} | ||
|
||
function jobqueue_install { | ||
docker exec -it pbs_master /bin/bash -c "cd /dask-jobqueue; python setup.py install" | ||
} | ||
|
||
function jobqueue_script { | ||
docker exec -it -u pbsuser pbs_master /bin/bash -c "cd /dask-jobqueue; py.test dask_jobqueue --verbose -E pbs" | ||
} | ||
|
||
function jobqueue_after_script { | ||
docker exec -it -u pbsuser pbs_master qstat -fx | ||
docker exec -it pbs_master bash -c 'cat /var/spool/pbs/sched_logs/*' | ||
docker exec -it pbs_master bash -c 'cat /var/spool/pbs/server_logs/*' | ||
docker exec -it pbs_master bash -c 'cat /var/spool/pbs/server_priv/accounting/*' | ||
docker exec -it pbs_slave_1 bash -c 'cat /var/spool/pbs/mom_logs/*' | ||
docker exec -it pbs_slave_1 bash -c 'cat /var/spool/pbs/spool/*' | ||
docker exec -it pbs_slave_1 bash -c 'cat /tmp/*.e*' | ||
docker exec -it pbs_slave_1 bash -c 'cat /tmp/*.o*' | ||
docker exec -it pbs_slave_2 bash -c 'cat /var/spool/pbs/mom_logs/*' | ||
docker exec -it pbs_slave_2 bash -c 'cat /var/spool/pbs/spool/*' | ||
docker exec -it pbs_slave_2 bash -c 'cat /tmp/*.e*' | ||
docker exec -it pbs_slave_2 bash -c 'cat /tmp/*.o*' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# inspired from https://github.com/PBSPro/pbspro/blob/v18.1.beta/docker/centos7/ | ||
# multi-stage build | ||
# build script will be triggered | ||
FROM centos:7.4.1708 AS builder | ||
# install dependencies for building | ||
RUN yum install -y gcc make rpm-build libtool hwloc-devel libX11-devel \ | ||
libXt-devel libedit-devel libical-devel ncurses-devel perl \ | ||
postgresql-devel python-devel tcl-devel tk-devel swig expat-devel \ | ||
openssl-devel libXext libXft git | ||
# get known PBS Pro source code | ||
RUN git clone --branch v14.1.2 https://github.com/pbspro/pbspro.git /src/pbspro | ||
COPY build.sh / | ||
RUN bash /build.sh | ||
|
||
# base image | ||
FROM centos:7.4.1708 | ||
LABEL description="PBS Professional Open Source and conda" | ||
|
||
#The pbs master node name, can be overriden if needed | ||
ENV PBS_MASTER pbs_master | ||
ENV PATH /opt/pbs/bin:/opt/anaconda/bin:$PATH | ||
ENV LANG en_US.UTF-8 | ||
ENV LC_ALL en_US.UTF-8 | ||
|
||
COPY --from=builder /root/rpmbuild/RPMS/x86_64/pbspro-server-*.rpm . | ||
# install pbspro and useful packages | ||
RUN yum install -y pbspro-server-*.rpm curl bzip2 git gcc sudo openssh-server && yum clean all | ||
# install python | ||
RUN curl -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ | ||
bash miniconda.sh -f -b -p /opt/anaconda && \ | ||
/opt/anaconda/bin/conda clean -tipy && \ | ||
rm -f miniconda.sh | ||
RUN conda install --yes -c conda-forge python=3.6 dask distributed flake8 pytest docrep | ||
# Take the latest version of distributed due to test failure otherwise (see #47 comment by mrocklin) | ||
RUN pip install --no-cache-dir git+https://github.com/dask/distributed.git --upgrade | ||
|
||
# Copy entrypoint and other needed scripts | ||
COPY ./*.sh / | ||
RUN chmod a+x ./*.sh | ||
|
||
# default entrypoint launch pbs master | ||
ENTRYPOINT ["bash", "/master-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
cd /src/pbspro | ||
./autogen.sh | ||
./configure -prefix=/opt/pbs | ||
make dist | ||
mkdir /root/rpmbuild /root/rpmbuild/SOURCES /root/rpmbuild/SPECS | ||
cp pbspro-*.tar.gz /root/rpmbuild/SOURCES | ||
cp pbspro.spec /root/rpmbuild/SPECS | ||
cd /root/rpmbuild/SPECS | ||
rpmbuild -ba pbspro.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
version: "2" | ||
|
||
services: | ||
|
||
master: | ||
build: . | ||
container_name: pbs_master | ||
hostname: pbs_master | ||
volumes: | ||
- ../..:/dask-jobqueue | ||
command: bash /run-master.sh | ||
|
||
slave_one: | ||
build: . | ||
container_name: pbs_slave_1 | ||
hostname: pbs_slave_1 | ||
volumes: | ||
- ../..:/dask-jobqueue | ||
entrypoint: "bash /slave-entrypoint.sh" | ||
command: bash /run-slave.sh | ||
links: | ||
- "master:pbs_master" | ||
environment: | ||
- PBS_MASTER=pbs_master | ||
depends_on: | ||
- master | ||
|
||
slave_two: | ||
build: . | ||
container_name: pbs_slave_2 | ||
hostname: pbs_slave_2 | ||
volumes: | ||
- ../..:/dask-jobqueue | ||
entrypoint: "bash /slave-entrypoint.sh" | ||
command: bash /run-slave.sh | ||
links: | ||
- "master:pbs_master" | ||
environment: | ||
- PBS_MASTER=pbs_master | ||
depends_on: | ||
- master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
pbs_conf_file=/etc/pbs.conf | ||
mom_conf_file=/var/spool/pbs/mom_priv/config | ||
hostname=$(hostname) | ||
|
||
# replace hostname in pbs.conf and mom_priv/config | ||
sed -i "s/PBS_SERVER=.*/PBS_SERVER=$hostname/" $pbs_conf_file | ||
sed -i "s/\$clienthost .*/\$clienthost $hostname/" $mom_conf_file | ||
|
||
# start PBS Pro | ||
/etc/init.d/pbs start | ||
|
||
# create default non-root user | ||
adduser pbsuser | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# Reduce time between PBS scheduling and add history | ||
qmgr -c "set server scheduler_iteration = 20" | ||
qmgr -c "set server job_history_enable = True" | ||
qmgr -c "set server job_history_duration = 24:00:00" | ||
|
||
# add two slaves to pbs | ||
qmgr -c "create node pbs_slave_1" | ||
qmgr -c "create node pbs_slave_2" | ||
|
||
# Start hanging process to leave the container up and running | ||
python -m http.server 8888 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
# Start hanging process to leave the container up and running | ||
python -m http.server 8888 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
pbs_conf_file=/etc/pbs.conf | ||
mom_conf_file=/var/spool/pbs/mom_priv/config | ||
hostname=$(hostname) | ||
|
||
# replace hostname in pbs.conf and mom_priv/config | ||
sed -i "s/PBS_SERVER=.*/PBS_SERVER=$PBS_MASTER/" $pbs_conf_file | ||
sed -i "s/\$clienthost .*/\$clienthost $hostname/" $mom_conf_file | ||
sed -i "s/PBS_START_SERVER=.*/PBS_START_SERVER=0/" $pbs_conf_file | ||
sed -i "s/PBS_START_SCHED=.*/PBS_START_SCHED=0/" $pbs_conf_file | ||
sed -i "s/PBS_START_COMM=.*/PBS_START_COMM=0/" $pbs_conf_file | ||
sed -i "s/PBS_START_MOM=.*/PBS_START_MOM=1/" $pbs_conf_file | ||
|
||
# Prevent PBS trying to use scp between host for stdout and stderr file of jobs | ||
# On standard PBS deployement, you would use a shared mount, or correctly configured passwordless scp | ||
echo "\$usecp *:/home/ /home/" >> $mom_conf_file | ||
echo "\$usecp *:/dask-jobqueue/ /tmp/" >> $mom_conf_file | ||
|
||
# start PBS Pro | ||
/etc/init.d/pbs start | ||
|
||
# create default non-root user | ||
adduser pbsuser | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
docker-compose up -d | ||
while [ `docker exec -it -u pbsuser pbs_master pbsnodes -a | grep "Mom = pbs_slave" | wc -l` -ne 2 ] | ||
do | ||
echo "Waiting for PBS slave nodes to become available"; | ||
sleep 2 | ||
done | ||
echo "PBS properly configured" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters