Skip to content

Commit

Permalink
Merge pull request #163 from CCBR/iss-162
Browse files Browse the repository at this point in the history
fix: correct renee base path for cache subcommand
  • Loading branch information
kelly-sovacool authored Oct 25, 2024
2 parents 25ede71 + a5599e3 commit dd2e3ff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- New contributing guide available on GitHub and the documentation website. (#159, @kelly-sovacool)
- New `renee debug` subcommand to determine the base directory for debugging purposes. (#159, @kelly-sovacool)
- Fix `renee cache` subcommand to correctly read the container images config file. (#163, @kelly-sovacool)

## RENEE 2.6.0

Expand Down
5 changes: 2 additions & 3 deletions src/renee/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,7 @@ def cache(sub_args):
"""
sif_cache = sub_args.sif_cache
# Get absolute PATH to templates in renee git repo
repo_path = os.path.dirname(os.path.abspath(__file__))
images = os.path.join(repo_path, "config", "containers", "images.json")
images = os.path.join(RENEE_PATH, "config", "containers", "images.json")

# Create image cache
if not os.path.exists(sif_cache):
Expand Down Expand Up @@ -462,7 +461,7 @@ def cache(sub_args):
username = os.environ.get("USER", os.environ.get("USERNAME"))
masterjob = subprocess.Popen(
"sbatch --parsable -J pl:cache --time=10:00:00 --mail-type=BEGIN,END,FAIL "
+ str(os.path.join(repo_path, "resources", "cacher"))
+ str(os.path.join(RENEE_PATH, "resources", "cacher"))
+ " slurm "
+ " -s '{}' ".format(sif_cache)
+ " -i '{}' ".format(",".join(pull))
Expand Down
7 changes: 7 additions & 0 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,10 @@ def test_get_singularity_cachedir():
]
errors = [assertion for assertion in assertions if not eval(assertion)]
assert not errors, "errors occurred:\n{}".format("\n".join(errors))


def test_cache_in_temp():
with tempfile.TemporaryDirectory() as tmp_dir:
outdir = os.path.join(tmp_dir, "testout")
output = shell_run(f"./bin/renee cache --sif-cache {outdir} --dry-run")
assert "Image will be pulled from" in output

0 comments on commit dd2e3ff

Please sign in to comment.