pipeline.cache
pipeline.cache
Functions for singularity cache management
Functions
Name | Description |
---|---|
check_cache | Check if provided SINGULARITY_CACHE is valid. Singularity caches cannot be |
get_sif_cache_dir | Get the directory path for SIF cache based on the HPC environment. |
get_singularity_cachedir | Returns the singularity cache directory. |
image_cache | Adds Docker Image URIs, or SIF paths to config if singularity cache option is provided. |
check_cache
*args, **kwargs) pipeline.cache.check_cache(parser, cache,
Check if provided SINGULARITY_CACHE is valid. Singularity caches cannot be shared across users (and must be owned by the user). Singularity strictly enforces 0700 user permission on the cache directory and will return a non-zero exit code.
Parameters
Name | Type | Description | Default |
---|---|---|---|
parser | argparse.ArgumentParser | Argparse parser object. | required |
cache | str | Singularity cache directory. | required |
Returns
Name | Type | Description |
---|---|---|
str | If singularity cache directory is valid. |
get_sif_cache_dir
=None) pipeline.cache.get_sif_cache_dir(hpc
Get the directory path for SIF cache based on the HPC environment.
Parameters
Name | Type | Description | Default |
---|---|---|---|
hpc | str | The name of the HPC environment. Supported values are “biowulf” and “frce”. Defaults to None. | None |
Returns
Name | Type | Description |
---|---|---|
str | The directory path for the SIF cache. Returns an empty string if the HPC environment is not recognized. |
get_singularity_cachedir
=None, cache_dir=None) pipeline.cache.get_singularity_cachedir(output_dir
Returns the singularity cache directory. If no user-provided cache directory is provided, the default singularity cache is in the output directory.
Parameters
Name | Type | Description | Default |
---|---|---|---|
output_dir | str | The directory where the output is stored. Defaults to the current working directory if not provided. | None |
cache_dir | str | The directory where the singularity cache is stored. Defaults to a hidden “.singularity” directory within the output directory if not provided. | None |
Returns
Name | Type | Description |
---|---|---|
str | The path to the singularity cache directory. |
image_cache
pipeline.cache.image_cache(sub_args, config)
Adds Docker Image URIs, or SIF paths to config if singularity cache option is provided.
If singularity cache option is provided and a local SIF does not exist, a warning is displayed and the image will be pulled from URI in ‘config/containers/images.json’.
Parameters
Name | Type | Description | Default |
---|---|---|---|
sub_args | argparse.Namespace | Parsed arguments for run sub-command. | required |
config | dict | Docker Image config dictionary. | required |
Returns
Name | Type | Description |
---|---|---|
dict | Updated config dictionary containing user information (username and home directory). |