Skip to content

Commit d7a0069

Browse files
committed
enh: add wrapper option for pooch cache
1 parent f9726e6 commit d7a0069

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

wrapper/src/nibabies_wrapper/__main__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def set_version(self):
187187
self.add_envvar((version_env, version))
188188

189189
def add_envvar(self, envtuple):
190-
"""Set an environmental variable
190+
"""Set an environment variable
191191
192192
Inputs
193193
------
@@ -197,7 +197,7 @@ def add_envvar(self, envtuple):
197197
env = '='.join(envtuple)
198198
self.add_cmd(['-e', env])
199199
elif self.service == 'singularity':
200-
# singularity will transfer over environmental variables
200+
# singularity will transfer over environment variables
201201
# with the prefix: SINGULARITYENV_
202202
envvar, value = envtuple
203203
envvar = 'SINGULARITYENV_' + envvar
@@ -476,6 +476,12 @@ def _is_file(path, parser):
476476
type=os.path.abspath,
477477
help='Filter file',
478478
)
479+
g_wrap.add_argument(
480+
'--pooch-cache-dir',
481+
metavar='DIR',
482+
type=os.path.abspath,
483+
help='Directory to serve as cache for pooch files'
484+
)
479485

480486
# Developer patch/shell options
481487
g_dev = parser.add_argument_group(
@@ -643,6 +649,9 @@ def main():
643649
if opts.deriv_filter_file:
644650
container.add_mount(opts.deriv_filter_file, '/opt/derivative_filters.json')
645651
unknown_args.extend(['--deriv-filter-file', '/opt/derivative_filters.json'])
652+
if opts.pooch_cache_dir:
653+
container.add_mount(opts.pooch_cache_dir, '/tmp/pooch_cache', read_only=False)
654+
container.add_envvar(('NIBABIES_POOCH_DIR', '/tmp/pooch_cache'))
646655
# Patch derivatives for searching
647656
if opts.derivatives:
648657
deriv_args = ['--derivatives']

0 commit comments

Comments
 (0)