Skip to content

Commit

Permalink
feat: set default singularity sif dir
Browse files Browse the repository at this point in the history
resolves #53
  • Loading branch information
kelly-sovacool committed Aug 2, 2024
1 parent 5b0d50e commit 3d998a5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/renee/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions src/renee/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 12 additions & 2 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -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))

0 comments on commit 3d998a5

Please sign in to comment.