diff --git a/CHANGELOG.md b/CHANGELOG.md index e50d49d..9e6ce03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Fix RSeQC environments: - Set RSeQC envmodule version to 4.0.0, which synchronizes it with the version in the docker container used by singularity. (#122, @kelly-sovacool) - Update docker with RSeQC's tools properly added to the path. (#123, @kelly-sovacool) +- Set default shared singularity SIF directory for biowulf and frce. (#94, @kelly-sovacool) ## RENEE 2.5.11 diff --git a/src/renee/__main__.py b/src/renee/__main__.py index dd65c75..01ccba7 100755 --- a/src/renee/__main__.py +++ b/src/renee/__main__.py @@ -24,6 +24,7 @@ import argparse # local imports +from .cache import get_sif_cache_dir from .run import run from .dryrun import dryrun from .gui import launch_gui @@ -907,6 +908,7 @@ def parsed_arguments(name, description): type=lambda option: os.path.abspath(os.path.expanduser(option)), required=False, help=argparse.SUPPRESS, + default=get_sif_cache_dir(), ) # Create NIDAP output folder diff --git a/src/renee/cache.py b/src/renee/cache.py index 2e9f5c0..21f9961 100644 --- a/src/renee/cache.py +++ b/src/renee/cache.py @@ -2,6 +2,17 @@ import os import sys +from .util import get_hpcname + + +def get_sif_cache_dir(hpc=get_hpcname()): + sif_dir = None + if hpc == "biowulf": + sif_dir = "/data/CCBR_Pipeliner/SIFS" + elif hpc == "frce": + sif_dir = "/mnt/projects/CCBR-Pipelines/SIFs" + return sif_dir + def image_cache(sub_args, config): """Adds Docker Image URIs, or SIF paths to config if singularity cache option is provided. diff --git a/tests/test_cache.py b/tests/test_cache.py index 1757785..f78c4e5 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -3,6 +3,8 @@ import os.path import subprocess +from src.renee.cache import get_sif_cache_dir + renee_run = ( "./bin/renee run " "--mode local --runmode init --dry-run " @@ -42,7 +44,15 @@ def test_cache_sif(): def test_cache_nosif(): output, config = run_in_temp(f"{renee_run}") assertions = [ - config["images"]["arriba"] == "docker://nciccbr/ccbr_arriba_2.0.0:v0.0.1", - "The singularity command has to be available" in output.stderr, + config["images"]["arriba"] == "docker://nciccbr/ccbr_arriba_2.0.0:v0.0.1" ] assert all(assertions) + + +def test_get_sif_cache_dir(): + assertions = [ + "'CCBR_Pipeliner/SIFS' in get_sif_cache_dir('biowulf')", + "'CCBR-Pipelines/SIFs' in get_sif_cache_dir('frce')", + ] + errors = [assertion for assertion in assertions if not eval(assertion)] + assert not errors, "errors occurred:\n{}".format("\n".join(errors))