-
-
Notifications
You must be signed in to change notification settings - Fork 150
Pbs docker ci #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Pbs docker ci #47
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ba2c15b
Squashing commit into one. Adding CI with dockerized PBS
guillaumeeb 9230e5e
Use latest distributed versio from master
guillaumeeb a6a1ec0
Fixing versions of OS and PBS for stability
guillaumeeb e6d5741
(Altered) tests workings with Docker on laptop. Modifying travis conf…
guillaumeeb 8f138ee
changing PBS scheduling time. Adding some trace at the end
guillaumeeb ffd8702
Disabling scp from stdout and stderr at the end of the jobs
guillaumeeb 7af1a11
Consistency with sge ci, improved debugging in travis
cnes-datalabs-bot ca514d9
docker-compose version 2 should be enough
guillaumeeb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remind me the difference between after_success and after_script, is that that after_script can still fail the build but not after_success?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference as I understand it is that after_success is run only if the script succeeded, and after_script is run no matter if the script succeeded or failed.
I don't believe any of those can fail the build.
I needed after_script to debug the failures.