Skip to content

Commit

Permalink
fix: set singularity cache dir (fixes #137)
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-sovacool committed Sep 10, 2024
1 parent 7b548f0 commit 54a3dd4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
19 changes: 19 additions & 0 deletions carlisle
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ function run() {
if [ "$1" == "local" ]; then
preruncleanup

$EXPORT_SING_CACHE_DIR_CMD

snakemake -s $SNAKEFILE \
--directory $WORKDIR \
--printshellcmds \
Expand Down Expand Up @@ -305,6 +307,8 @@ function run() {
cd \$SLURM_SUBMIT_DIR
$EXPORT_SING_CACHE_DIR_CMD
snakemake -s $SNAKEFILE \
--directory $WORKDIR \
--use-singularity \
Expand Down Expand Up @@ -384,6 +388,9 @@ function main(){
-f|--force)
FORCEFLAG="ON"
;;
-c=*|--singcache=*)
SING_CACHE_DIR="${i#*=}"
;;
-v|--version)
get_version && exit 0
;;
Expand All @@ -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;;
Expand Down
12 changes: 11 additions & 1 deletion docs/user-guide/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<RUNMODE> -w/--workdir=<WORKDIR>
1. RUNMODE: [Type: String] Valid options:
*) init : initialize workdir
*) run : run with slurm
Expand All @@ -17,6 +20,13 @@ Usage: bash ./data/CCBR_Pipeliner/Pipelines/CARLISLE/carlisle -m/--runmode=<RUNM
2. WORKDIR: [Type: String]: Absolute or relative path to the output folder with write permissions.
```

### Optional arguments

--help|-h : print this help.
--version|-v : print the version of carlisle.
--force|-f : use the force flag for snakemake to force all rules to run.
--singcache|-c : singularity cache directory. Default is `/data/${USER}/.singularity` if available, or falls back to `${WORKDIR}/.singularity`. Use this flag to specify a different singularity cache directory.

## 3.2 Commands explained

The following explains each of the command options:
Expand Down

0 comments on commit 54a3dd4

Please sign in to comment.