From 54a3dd4b38d267ccf1903b96565d62214800320e Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 10 Sep 2024 12:58:35 -0400 Subject: [PATCH 1/3] fix: set singularity cache dir (fixes #137) --- carlisle | 19 +++++++++++++++++++ docs/user-guide/run.md | 12 +++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/carlisle b/carlisle index 367c2ea..9d6488d 100755 --- a/carlisle +++ b/carlisle @@ -268,6 +268,8 @@ function run() { if [ "$1" == "local" ]; then preruncleanup + $EXPORT_SING_CACHE_DIR_CMD + snakemake -s $SNAKEFILE \ --directory $WORKDIR \ --printshellcmds \ @@ -305,6 +307,8 @@ function run() { cd \$SLURM_SUBMIT_DIR + $EXPORT_SING_CACHE_DIR_CMD + snakemake -s $SNAKEFILE \ --directory $WORKDIR \ --use-singularity \ @@ -384,6 +388,9 @@ function main(){ -f|--force) FORCEFLAG="ON" ;; + -c=*|--singcache=*) + SING_CACHE_DIR="${i#*=}" + ;; -v|--version) get_version && exit 0 ;; @@ -398,6 +405,18 @@ function main(){ WORKDIR=$(readlink -m "$WORKDIR") echo "Working Dir: $WORKDIR" + if [[ -z "$SING_CACHE_DIR" ]]; then + echo "singularity cache dir (--singcache) is not set" + if [[ -d "/data/$USER" ]]; then + SING_CACHE_DIR="/data/$USER/.singularity" + else + SING_CACHE_DIR="${WORKDIR}/.singularity" + fi + echo "\tusing ${SING_CACHE_DIR}" + fi + mkdir -p $SING_CACHE_DIR + EXPORT_SING_CACHE_DIR_CMD="export SINGULARITY_CACHEDIR=\"${SING_CACHE_DIR}\"" + case $RUNMODE in init) init && exit 0;; dryrun) dryrun && exit 0;; diff --git a/docs/user-guide/run.md b/docs/user-guide/run.md index bd03a45..2deeadd 100644 --- a/docs/user-guide/run.md +++ b/docs/user-guide/run.md @@ -2,10 +2,13 @@ ## 3.1 Pipeline Overview -The Snakemake workflow has a multiple options: +The Snakemake workflow has a multiple options + +### Required arguments ``` Usage: bash ./data/CCBR_Pipeliner/Pipelines/CARLISLE/carlisle -m/--runmode= -w/--workdir= + 1. RUNMODE: [Type: String] Valid options: *) init : initialize workdir *) run : run with slurm @@ -17,6 +20,13 @@ Usage: bash ./data/CCBR_Pipeliner/Pipelines/CARLISLE/carlisle -m/--runmode= Date: Tue, 10 Sep 2024 13:01:57 -0400 Subject: [PATCH 2/3] chore: update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e23fcba..74e358b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - New parameters in the config file to make certain rules optional: (#133, @kelly-sovacool) - GO enrichment is controlled by `run_go_enrichment` (default: `false`) - ROSE is controlled by `run_rose` (default: `false`) +- New `--singcache` argument to provide a singularity cache dir location. The singularity cache dir is automatically set inside `/data/$USER/` or `$WORKDIR/` if `--singcache` is not provided. (#143, @kelly-sovacool) ### Misc From 240afd242d2ad09548af2ee487950a806b520b6d Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 10 Sep 2024 13:04:30 -0400 Subject: [PATCH 3/3] style: simplify singcache echo statement --- carlisle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/carlisle b/carlisle index 9d6488d..315622d 100755 --- a/carlisle +++ b/carlisle @@ -406,13 +406,12 @@ function main(){ echo "Working Dir: $WORKDIR" if [[ -z "$SING_CACHE_DIR" ]]; then - echo "singularity cache dir (--singcache) is not set" if [[ -d "/data/$USER" ]]; then SING_CACHE_DIR="/data/$USER/.singularity" else SING_CACHE_DIR="${WORKDIR}/.singularity" fi - echo "\tusing ${SING_CACHE_DIR}" + echo "singularity cache dir (--singcache) is not set, using ${SING_CACHE_DIR}" fi mkdir -p $SING_CACHE_DIR EXPORT_SING_CACHE_DIR_CMD="export SINGULARITY_CACHEDIR=\"${SING_CACHE_DIR}\""