From 8d00c7c84a46756262fe3d2268cf93f56ee4ce56 Mon Sep 17 00:00:00 2001 From: Paul Stretenowich Date: Thu, 24 Oct 2024 17:03:06 -0400 Subject: [PATCH] Consolidation + removing dev GenPipes as GenPipes 5 is a package --- .dockerignore | 2 +- .github/workflows/docker-publish.yml | 72 +++++++++++++++++++ .gitignore | 5 +- Dockerfile | 37 ++++++---- README.md | 72 +++++++++++-------- {singularity => container}/build_release.sh | 0 .../wrapper_genpipes/bin/container_wrapper.sh | 70 ++++++++++++++++++ .../wrapper_genpipes/etc/wrapper.conf.tpl | 1 + devmodule/genpipes/dev_genpipes | 27 ------- genpipesrc | 23 +++--- init_genpipes | 31 +++----- .../wrapper_genpipes/bin/container_wrapper.sh | 30 -------- util_docker.sh | 9 --- util_singularity.sh | 8 --- 14 files changed, 236 insertions(+), 151 deletions(-) create mode 100644 .github/workflows/docker-publish.yml rename {singularity => container}/build_release.sh (100%) create mode 100755 container/wrapper_genpipes/bin/container_wrapper.sh rename {singularity => container}/wrapper_genpipes/etc/wrapper.conf.tpl (82%) delete mode 100644 devmodule/genpipes/dev_genpipes delete mode 100755 singularity/wrapper_genpipes/bin/container_wrapper.sh delete mode 100755 util_docker.sh delete mode 100755 util_singularity.sh diff --git a/.dockerignore b/.dockerignore index cfd3264..acc2d3f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1 @@ -singularity/ +container/ diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..d465228 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,72 @@ +# +name: Create and publish a Docker image + +# Configures this workflow to run every time a change is pushed to the branch called 'main' or a PR is opened on 'main. +on: + push: + branches: ['main'] + pull_request: + branches: ['main'] + +# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. +jobs: + build-and-push-image: + runs-on: ubuntu-latest + + # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Uses the `docker/login-action` action to log in to the Container registry using the account and password that will publish the packages. + # Once published, the packages are scoped to the account defined here. + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. + # The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. + # If the build succeeds, it pushes the image to GitHub Packages. + # It uses the `context` parameter to define the build's context as the set of files located in the specified path. + # For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. + # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. + - name: Build and push Docker image + id: push + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + platforms: linux/amd64,linux/arm64 + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + # This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. + # It increases supply chain security for people who consume the image. + # For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)." + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/.gitignore b/.gitignore index 7fa6da8..7e53c32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ cvmfschecksum.* *_mount_cache.sh -singularity/wrapper_genpipes/images -singularity/wrapper_genpipes.tgz +container/wrapper_genpipes/images +container/wrapper_genpipes.tgz +.DS_Store diff --git a/Dockerfile b/Dockerfile index fe2cec9..18a439c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,26 @@ -FROM centos:7.9.2009 -MAINTAINER P-O Quirion po.quirion@mcgill.ca +FROM ubuntu:24.04 +LABEL authors="P-O Quirion po.quirion@mcgill.ca, Paul Stretenowich paul.stretenowich@mcgill.ca" WORKDIR /tmp -# All yum cmd - -ENV CVMFS_VERSION latest -ENV CC_STACK latest -ENV MODULE_VERSION 4.1.2 -RUN yum install -y https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-${CVMFS_VERSION}.noarch.rpm \ - https://package.computecanada.ca/yum/cc-cvmfs-public/prod/RPM/computecanada-release-${CC_STACK}.noarch.rpm -RUN yum update -y \ - && yum install -y ImageMagick pigz which wget zip unzip.x86_64 make.x86_64 gcc expectk file \ - dejagnu less tcl-devel.x86_64 cvmfs-config-computecanada \ - cvmfs-fuse3 cvmfs-config-default \ - && yum clean all +ENV CVMFS_VERSION=latest +ENV CC_STACK=latest +ENV MODULE_VERSION=4.1.2 + +# All apt-get cmd +RUN apt-get update -y && \ + apt-get install -y wget lsb-release +RUN wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-${CVMFS_VERSION}_all.deb && \ + dpkg -i cvmfs-release-${CVMFS_VERSION}_all.deb && \ + rm -f cvmfs-release-${CVMFS_VERSION}_all.deb && \ + apt-get update -y && \ + apt-get install -y cvmfs +RUN wget https://package.computecanada.ca/yum/cc-cvmfs-public/prod/other/cvmfs-config-computecanada-${CC_STACK}.all.deb && \ + apt-get install -y ./cvmfs-config-computecanada-${CC_STACK}.all.deb && \ + rm -f cvmfs-config-computecanada-${CC_STACK}.all.deb +RUN apt-get install -y libpng-dev libjpeg-dev libtiff-dev && \ + apt-get install -y imagemagick pigz which zip unzip make gcc expect file dejagnu less tcl-dev cvmfs-config-computecanada cvmfs-fuse3 cvmfs-config-default && \ + apt-get clean all RUN mkdir /cvmfs-cache && chmod 777 /cvmfs-cache /cvmfs RUN mkdir /cvmfs/ref.mugqic /cvmfs/soft.mugqic /cvmfs/cvmfs-config.computecanada.ca @@ -25,6 +31,7 @@ RUN tar xzf modules-${MODULE_VERSION}.tar.gz && \ rm modules-${MODULE_VERSION}.tar.gz \ && cd modules-${MODULE_VERSION} && ./configure && make -j 7 && make install \ && cd .. && rm -rf modules-${MODULE_VERSION} && rm -rf /usr/local/Modules/modulefiles/* + # CVMFS ADD default.local /etc/cvmfs/default.local ADD soft.mugqic.local /etc/cvmfs/config.d/soft.mugqic.local @@ -35,7 +42,7 @@ RUN echo "source /etc/profile.d/z00_module.sh" >> /etc/bashrc ADD devmodule/genpipes "/usr/local/Modules/modulefiles/." -ADD genpipesrc /usr/local/etc/genpiperc +ADD genpipesrc /usr/local/etc/genpiperc RUN ["ln", "-s", "/usr/local/etc/genpiperc", "/etc/profile.d/z90_genpipes.sh"] ADD init_genpipes /usr/local/bin/init_genpipes diff --git a/README.md b/README.md index 019243a..47f538f 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,49 @@ # GenPipes in a container -You can use GenPipes in a Container (GiaC) to run GenPipes on a single machine, on a a Torque/PBS cluster or on a SLURM cluster. +You can use GenPipes in a Container (GiaC) to run GenPipes on a single machine, on a Torque/PBS cluster or on a SLURM cluster. -If [Singularity](https://github.com/hpcng/singularity) is installed on your LINUX machine you are all set, a simple user with no special privilege is enough (no sudo needed). - -While you can use (GiaC) to debug and develop GenPipes on your laptop, [GenPipes](https://bitbucket.org/mugqic/genpipes/src/master/README.md) is design to run analysis on Super Computers. +If Singularity/Docker is installed on your LINUX machine you are all set, a simple user with no special privilege is enough (no sudo needed). +While you can use (GiaC) to debug GenPipes on your laptop, [GenPipes](https://bitbucket.org/mugqic/genpipes/src/master/README.md) is design to run analysis on Super Computers. ## Install a compatible container technology on your machine -Follow installation procedure from the [Singularity install page](ttps://github.com/hpcng/singularity/blob/master/INSTALL.md) +Follow installation procedure from the [Singularity install page](https://github.com/hpcng/singularity/blob/master/INSTALL.md) or the [Docker install page](https://docs.docker.com/get-docker/). -You can also [Read the GenPipes documentation](https://genpipes.readthedocs.io/) +You can also [Read the GenPipes documentation](https://genpipes.readthedocs.io/). ## What exactly is avalable in that container? -The full tested and integrated C3G/MUGQIC software stack, a complete set of genomics references. -[For more details: http://www.computationalgenomics.ca/cvmfs-modules/](http://www.computationalgenomics.ca/cvmfs-modules/) - +The full tested and integrated C3G/MUGQIC software stack: a complete set of genomics references and bioinformatics softwares. [For more details: http://www.computationalgenomics.ca/cvmfs-modules/](http://www.computationalgenomics.ca/cvmfs-modules/) ## Setup a GiaC environment -You can use this container to develop and test new version of GenPipes. +You can use this container to test new version of GenPipes. -Fist, clone GenPipes somewhere under your $HOME folder three. Then get the container wrapper: +First, clone GenPipes and then get the container wrapper: ``` -git clone https://bitbucket.org/mugqic/genpipes $WORKDIR/genpipes +git clone https://bitbucket.org/mugqic/genpipes -$WORKDIR/genpipes/resources/container/get_wrapper.sh +genpipes/resources/container/get_wrapper.sh ``` -You can now configuere the `$WORKDIR/genpipes/resources/container/etc/wrapper.conf` file: +You can now configure the `genpipes/resources/container/etc/wrapper.conf` file: ``` # GEN_SHARED_CVMFS should have a sufficient amount of space to load full reference files export GEN_SHARED_CVMFS=$HOME/cvmfs BIND_LIST= +GEN_CONTAINERTYPE=singularity ``` `GEN_SHARED_CVMFS` will hold a cache for GiaC [CVMFS](https://cernvm.cern.ch/portal/filesystem) system, it will hold the genomes and software being used by GenPipes. This folder will grow with GenPipes usage. You can delete it in between usage, but keep in mind that once deleted it will need to be rebuild by downloading data form the internet. `BIND_LIST` is a list of file system, separated by comma, you need GenPipes to have access to, by default, only your $HOME is mounted. For example if you are on an HPC system with a `/scratch` and `/data` space, you would have `BIND_LIST=/scratch,/data`. The string will be fed to Singularity `--bind` option, see `singularity --help` for more details. +`GEN_CONTAINERTYPE` is the container to use, either `singularity` (default) or `docker`. + You do not need any other setup on your machine. ## PIPELINE USAGE @@ -53,25 +53,41 @@ https://genpipes.readthedocs.io/ # On SLURM or PBS/torque HPC -Create an ini file that fits your system and for the pipeline(s) you want to use. - -Add the `-j {pbs,slurm}` option to fit your scheduler then the `--wrap` options so GenPipes with wrap all its command with the container instrumentation. +[Read the GenPipes documentation](https://genpipes.readthedocs.io/), follow guidelines there to launch a GenPipes pipeline and add the `--wrap` option so GenPipes with wrap all its command with the container instrumentation. # On a single machine. ## With the wrapper -Run the pipeline with the `--wrap`, `-j batch` and `--no-json` options! +[Read the GenPipes documentation](https://genpipes.readthedocs.io/), follow guidelines there to launch a GenPipes pipeline and add the `--wrap`, `-j batch` and `--no-json` options. -You can also run the `./genpipes/resources/container/bin/container_wrapper.sh` command to get inside the container with the right configuration. You will then have access to all the GenPipes tools be able to run them directly inside the container, on a single host without the `--wrap` option. +You can also run the `genpipes/resources/container/bin/container_wrapper.sh` command to get inside the container with the right configuration. You will then have access to all the GenPipes tools be able to run them directly inside the container, on a single host without the `--wrap` option. ## Whitout the wrapper -With `GEN_SHARED_CVMFS` being the cache directory on the host, `BIND_LIST` the file system to be acces by genpipes, {IMAGE_PATH}/genpipes.sif the [latest sif file released](https://github.com/c3g/genpipes_in_a_container/releases/latest). +### Using Singularity +With `GEN_SHARED_CVMFS` being the cache directory on the host, `BIND_LIST` the file system to be accessed by genpipes, {IMAGE_PATH}/genpipes.sif the [latest sif file released](https://github.com/c3g/genpipes_in_a_container/releases/latest). ``` - singularity run --cleanenv -S /var/run/cvmfs -B ${GEN_SHARED_CVMFS}:/cvmfs-cache \ - -B "$BIND_LIST" \ - --fusemount \ - "container:cvmfs2 cvmfs-config.computecanada.ca /cvmfs/cvmfs-config.computecanada.ca" \ - --fusemount "container:cvmfs2 soft.mugqic /cvmfs/soft.mugqic" \ - --fusemount "container:cvmfs2 ref.mugqic /cvmfs/ref.mugqic" \ - ${IMAGE_PATH}/genpipes.sif "$@" + singularity run \ + --cleanenv \ + -S /var/run/cvmfs \ + -B ${GEN_SHARED_CVMFS}:/cvmfs-cache \ + -B "$BIND_LIST" \ + --fusemount "container:cvmfs2 cvmfs-config.computecanada.ca /cvmfs/cvmfs-config.computecanada.ca" \ + --fusemount "container:cvmfs2 soft.mugqic /cvmfs/soft.mugqic" \ + --fusemount "container:cvmfs2 ref.mugqic /cvmfs/ref.mugqic" \ + ${IMAGE_PATH}/genpipes.sif +``` +### Using Docker +With `GEN_SHARED_CVMFS` being the cache directory on the host and `BIND_LIST` the file system to be accessed by genpipes. +``` +docker run \ + -it \ + --env-file $HOME/.genpipes_env \ + --rm \ + --device /dev/fuse \ + --cap-add SYS_ADMIN \ + --tmpfs /var/run/cvmfs:rw \ + -w $PWD \ + -v $PWD:$PWD \ + --mount type=bind,source=${BIND_LIST},target=${BIND_LIST} \ + --mount type=bind,source=${GEN_SHARED_CVMFS},target=/cvmfs-cache \ + c3genomics/genpipes:latest ``` - diff --git a/singularity/build_release.sh b/container/build_release.sh similarity index 100% rename from singularity/build_release.sh rename to container/build_release.sh diff --git a/container/wrapper_genpipes/bin/container_wrapper.sh b/container/wrapper_genpipes/bin/container_wrapper.sh new file mode 100755 index 0000000..aedc930 --- /dev/null +++ b/container/wrapper_genpipes/bin/container_wrapper.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +# Do not modify this file modify ${SCRIPTPATH}/etc/wrapper.conf instead! +SCRIPTPATH="$(cd "$(dirname "$0")" ; pwd -P)" +SCRIPTPATH=${SCRIPTPATH%%bin} +SCRIPTPATH=${SCRIPTPATH%%/} +GEN_SHARED_CVMFS=/tmp/cvmfs-cache +GEN_CONTAINERTYPE=singularity + +source "${SCRIPTPATH}"/etc/wrapper.conf + +mkdir -p ${GEN_SHARED_CVMFS} + +touch "$HOME/.genpipes_env" # needs to exist for the run cmd not to crash + +# If GEN_CONTAINERTYPE equals singularity +if [ "$GEN_CONTAINERTYPE" = "singularity" ]; then + if [ -z ${BIND_LIST+x} ]; then + singularity run \ + --env-file $HOME/.genpipes_env \ + --cleanenv \ + -S /var/run/cvmfs \ + -B ${GEN_SHARED_CVMFS}:/cvmfs-cache \ + --fusemount "container:cvmfs2 cvmfs-config.computecanada.ca /cvmfs/cvmfs-config.computecanada.ca" \ + --fusemount "container:cvmfs2 soft.mugqic /cvmfs/soft.mugqic" \ + --fusemount "container:cvmfs2 ref.mugqic /cvmfs/ref.mugqic" \ + ${SCRIPTPATH}/images/genpipes.sif "$@" + else + singularity run \ + --env-file $HOME/.genpipes_env \ + --cleanenv \ + -S /var/run/cvmfs \ + -B ${GEN_SHARED_CVMFS}:/cvmfs-cache \ + -B "$BIND_LIST" \ + --fusemount "container:cvmfs2 cvmfs-config.computecanada.ca /cvmfs/cvmfs-config.computecanada.ca" \ + --fusemount "container:cvmfs2 soft.mugqic /cvmfs/soft.mugqic" \ + --fusemount "container:cvmfs2 ref.mugqic /cvmfs/ref.mugqic" \ + ${SCRIPTPATH}/images/genpipes.sif "$@" + fi +elif [ "$GEN_CONTAINERTYPE" = "docker" ]; then + if [ -z ${BIND_LIST+x} ]; then + docker run \ + -it \ + --env-file $HOME/.genpipes_env \ + --rm \ + --device /dev/fuse \ + --cap-add SYS_ADMIN \ + --tmpfs /var/run/cvmfs:rw \ + -w $PWD \ + -v $PWD:$PWD \ + --mount type=bind,source=${BIND_LIST},target=${BIND_LIST} \ + --mount type=bind,source=${GEN_SHARED_CVMFS},target=/cvmfs-cache \ + c3genomics/genpipes:latest "$@" + else + docker run \ + -it \ + --env-file $HOME/.genpipes_env \ + --rm \ + --device /dev/fuse \ + --cap-add SYS_ADMIN \ + --tmpfs /var/run/cvmfs:rw \ + -w $PWD \ + -v $PWD:$PWD \ + --mount type=bind,source=${GEN_SHARED_CVMFS},target=/cvmfs-cache \ + c3genomics/genpipes:latest "$@" + fi +else + echo "Unknown GEN_CONTAINERTYPE $GEN_CONTAINERTYPE. Choose between 'singularity' or 'docker'. Exiting." + exit 1 +fi diff --git a/singularity/wrapper_genpipes/etc/wrapper.conf.tpl b/container/wrapper_genpipes/etc/wrapper.conf.tpl similarity index 82% rename from singularity/wrapper_genpipes/etc/wrapper.conf.tpl rename to container/wrapper_genpipes/etc/wrapper.conf.tpl index 57886b1..5dc6d13 100644 --- a/singularity/wrapper_genpipes/etc/wrapper.conf.tpl +++ b/container/wrapper_genpipes/etc/wrapper.conf.tpl @@ -1,3 +1,4 @@ # GEN_SHARED_CVMFS should have a sufficient amount of space to load full reference files export GEN_SHARED_CVMFS=$HOME/cvmfs BIND_LIST= +GEN_CONTAINERTYPE=singularity \ No newline at end of file diff --git a/devmodule/genpipes/dev_genpipes b/devmodule/genpipes/dev_genpipes deleted file mode 100644 index efbcaaa..0000000 --- a/devmodule/genpipes/dev_genpipes +++ /dev/null @@ -1,27 +0,0 @@ -#%Module1.0 -proc ModulesHelp { } { - - puts stderr "\tDev - genpipes " -} -module-whatis "genpipes" -set root $env(GENPIPES_DEV_DIR) -if { [ module-info mode load ] } { - puts stderr "unloading mugqic/genpipes" - module unload mugqic/genpipes - puts stderr "Load GENPIPES available in '$root'" -} -setenv MUGQIC_PIPELINES_HOME $root -prepend-path PATH $root/utils -prepend-path PATH $root/pipelines/ampliconseq -prepend-path PATH $root/pipelines/chipseq -prepend-path PATH $root/pipelines/dnaseq -prepend-path PATH $root/pipelines/dnaseq_high_coverage -prepend-path PATH $root/pipelines/illumina_run_processing -prepend-path PATH $root/pipelines/methylseq -prepend-path PATH $root/pipelines/pacbio_assembly -prepend-path PATH $root/pipelines/rnaseq -prepend-path PATH $root/pipelines/rnaseq_denovo_assembly -prepend-path PATH $root/pipelines/tumor_pair -prepend-path PATH $root/pipelines/hicseq - - diff --git a/genpipesrc b/genpipesrc index 4ec5d71..830561c 100755 --- a/genpipesrc +++ b/genpipesrc @@ -1,8 +1,7 @@ #source /etc/bashrc #source ~/.bashrc if [ -z "${QUIET+x}" ]; then -echo -e "\nWait while Genpipes module are loaded. This could take a while," -echo -e " especially if the cvmfs cache is new\n" +echo -e "\nWait while Genpipes module are loaded. This could take a while, especially if the cvmfs cache is new.\n" fi mount -l | grep soft.mugqic 2>/dev/null 1>&2 @@ -14,20 +13,22 @@ if [ ${retcode} -ne 0 ] ; then mount -t cvmfs soft.mugqic /cvmfs/soft.mugqic fi - module use $MUGQIC_INSTALL_HOME/modulefiles +if [ -z "${PIPELINE_VERSION+x}" ]; then + PIPELINE_VERSION=$(module avail -d mugqic/genpipes 2>&1 | grep -o '[0-9]\.[0-9]\.[0-9]') + export PIPELINE_VERSION=/${PIPELINE_VERSION} +fi + if [[ ${PIPELINE_VERSION##/} =~ 3\.[0-9]+\.[0-9]+ ]]; then # version 3 releases are in python 2 module load mugqic/python/2.7.14 -else - # 4 and up are using the default python 3 +elif [[ ${PIPELINE_VERSION##/} =~ 4\.[0-9]+\.[0-9]+ ]]; then + # version 4 releases are in python 3 module load mugqic/python -fi - -if [ -z "${GENPIPES_DEV_DIR+x}" ]; then - module load mugqic/genpipes${PIPELINE_VERSION} else - module use /usr/local/Modules/modulefiles - module load dev_genpipes + # 5 and up are NOT loading python anymore as GenPipes is now a pip package + : fi + +module load mugqic/genpipes${PIPELINE_VERSION} diff --git a/init_genpipes b/init_genpipes index b35e374..4e12441 100644 --- a/init_genpipes +++ b/init_genpipes @@ -7,18 +7,16 @@ export MUGQIC_INSTALL_HOME=/cvmfs/soft.mugqic/CentOS6 usage (){ - echo -e "\nUsage: $0 [ -d ] [-V ] [ ] " 1>&2; + echo -e "\nUsage: $0 [ [ -V ] [ ]" 1>&2; echo -e "\nOPTION" - echo -e "\t-d Set a path to a genpipes repo that can supersedes" - echo -e "\t the soft.mugqic repo's version (developer's mode)" - echo -e "\t-V Genpipes version (will default to latest release)" - echo -e "\t-v vebose mode, makes the parrot talk" + echo -e "\t-V GenPipes version (will default to latest release)" + echo -e "\t-v Vebose mode, makes the parrot talk" echo } export QUIET="-d clear" -while getopts ":d:vV:h" opt; do +while getopts ":vV:h" opt; do case $opt in v) unset QUIET @@ -26,9 +24,6 @@ while getopts ":d:vV:h" opt; do V) export PIPELINE_VERSION=/${OPTARG} ;; - d) - export GENPIPES_DEV_DIR=/${OPTARG} - ;; h) usage exit 0 @@ -45,26 +40,22 @@ while getopts ":d:vV:h" opt; do esac done - shift $((OPTIND-1)) # move the exec line to a script if [ $# -gt 0 ] ; then function finish { - rm ${genpipe_script} + rm "${genpipes_script}" } - genpipe_script=$(mktemp /tmp/genpipe_script.XXXXXX) + genpipes_script=$(mktemp /tmp/genpipes_script.XXXXXX) trap finish EXIT - chmod 755 ${genpipe_script} - echo '#! /bin/bash' >> ${genpipe_script} - echo "$@" >> ${genpipe_script} + chmod 755 "${genpipes_script}" + echo '#!/bin/bash' >> "${genpipes_script}" + echo "$@" >> "${genpipes_script}" fi - - # load cvmfs -if [ ${genpipe_script} ]; then - bash -ilc "${genpipe_script}" +if [ "${genpipes_script}" ]; then + bash -ilc "${genpipes_script}" else bash -il fi - diff --git a/singularity/wrapper_genpipes/bin/container_wrapper.sh b/singularity/wrapper_genpipes/bin/container_wrapper.sh deleted file mode 100755 index 3946286..0000000 --- a/singularity/wrapper_genpipes/bin/container_wrapper.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# Do not modify this file modify ${SCRIPTPATH}/etc/wrapper.conf instead! -SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" -SCRIPTPATH=${SCRIPTPATH%%bin} -SCRIPTPATH=${SCRIPTPATH%%/} -GEN_SHARED_CVMFS=/tmp/cvmfs-cache - -source ${SCRIPTPATH}/etc/wrapper.conf - -mkdir -p ${GEN_SHARED_CVMFS} - -touch $HOME/.genpipes_env # needs to exist for the run cmd not to crash - -if [ -z ${BIND_LIST+x} ]; then - singularity run --env-file $HOME/.genpipes_env --cleanenv -S /var/run/cvmfs -B ${GEN_SHARED_CVMFS}:/cvmfs-cache \ - --fusemount \ - "container:cvmfs2 cvmfs-config.computecanada.ca /cvmfs/cvmfs-config.computecanada.ca" \ - --fusemount "container:cvmfs2 soft.mugqic /cvmfs/soft.mugqic" \ - --fusemount "container:cvmfs2 ref.mugqic /cvmfs/ref.mugqic" \ - ${SCRIPTPATH}/images/genpipes.sif "$@" -else - singularity run --env-file $HOME/.genpipes_env --cleanenv -S /var/run/cvmfs -B ${GEN_SHARED_CVMFS}:/cvmfs-cache \ - -B "$BIND_LIST" \ - --fusemount \ - "container:cvmfs2 cvmfs-config.computecanada.ca /cvmfs/cvmfs-config.computecanada.ca" \ - --fusemount "container:cvmfs2 soft.mugqic /cvmfs/soft.mugqic" \ - --fusemount "container:cvmfs2 ref.mugqic /cvmfs/ref.mugqic" \ - ${SCRIPTPATH}/images/genpipes.sif "$@" -fi diff --git a/util_docker.sh b/util_docker.sh deleted file mode 100755 index da6f692..0000000 --- a/util_docker.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/bash - -args=$@ -if [ $# -lt 1 ]; then - args=c3genomics/genpipes:alpha -fi - - -docker run --rm --device /dev/fuse --cap-add SYS_ADMIN -v /tmp:/tmp -it -w $PWD -v $HOME:$HOME -v $HOME/cvmfs_caches/:/cvmfs-cache/ $args diff --git a/util_singularity.sh b/util_singularity.sh deleted file mode 100755 index 053ae28..0000000 --- a/util_singularity.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/bash - args=$@ -if [ $# -lt 1 ]; then - args=../genpipes_alpha.sif -fi - - -singularity run -S /var/run/cvmfs -B ~/cvmfs_cache:/cvmfs-cache --fusemount "container:cvmfs2 cvmfs-config.computecanada.ca /cvmfs/cvmfs-config.computecanada.ca" --fusemount "container:cvmfs2 soft.mugqic /cvmfs/soft.mugqic" --fusemount "container:cvmfs2 ref.mugqic /cvmfs/ref.mugqic" ${args}