From ebe6584586de18053b31c5061bb13c134183bd52 Mon Sep 17 00:00:00 2001 From: Matthieu Muffato Date: Tue, 3 Oct 2023 17:33:28 +0000 Subject: [PATCH 1/3] Missing doc --- docs/getting_started/user-guide.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/getting_started/user-guide.rst b/docs/getting_started/user-guide.rst index 95de9a36d..c73cbb21c 100644 --- a/docs/getting_started/user-guide.rst +++ b/docs/getting_started/user-guide.rst @@ -203,6 +203,9 @@ variable replacement. A summary table of variables is included below, and then f * - singularity_module - if defined, add to module script to load this Singularity module first - null + * - podman_module + - if defined, add to module script to load this Podman module first + - null * - module_name - Format string for module commands exec,shell,run (not aliases) can include ``{{ registry }}``, ``{{ repository }}``, ``{{ tool }}`` and ``{{ version }}`` - ``'{{ tool }}'`` From 12e547a7501944501a63570699abcbf13921dff6 Mon Sep 17 00:00:00 2001 From: Matthieu Muffato Date: Tue, 3 Oct 2023 17:33:51 +0000 Subject: [PATCH 2/3] Added an option to configure the path to singularity directly --- docs/getting_started/user-guide.rst | 2 ++ shpc/main/schemas.py | 1 + shpc/main/wrappers/templates/singularity/exec.sh | 2 +- shpc/main/wrappers/templates/singularity/inspect-deffile.sh | 2 +- shpc/main/wrappers/templates/singularity/inspect-runscript.sh | 2 +- shpc/main/wrappers/templates/singularity/run.sh | 2 +- shpc/main/wrappers/templates/singularity/shell.sh | 2 +- shpc/settings.yml | 3 +++ 8 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/getting_started/user-guide.rst b/docs/getting_started/user-guide.rst index c73cbb21c..8a9b29b04 100644 --- a/docs/getting_started/user-guide.rst +++ b/docs/getting_started/user-guide.rst @@ -206,6 +206,8 @@ variable replacement. A summary table of variables is included below, and then f * - podman_module - if defined, add to module script to load this Podman module first - null + * - singularity_path + - path to (or name of) the `singularity` executable to use in wrapper scripts. Can be used instead of / with `singularity_module` * - module_name - Format string for module commands exec,shell,run (not aliases) can include ``{{ registry }}``, ``{{ repository }}``, ``{{ tool }}`` and ``{{ version }}`` - ``'{{ tool }}'`` diff --git a/shpc/main/schemas.py b/shpc/main/schemas.py index 7195ef715..1cf78edf6 100644 --- a/shpc/main/schemas.py +++ b/shpc/main/schemas.py @@ -143,6 +143,7 @@ "namespace": {"type": ["string", "null"]}, "singularity_module": {"type": ["string", "null"]}, "podman_module": {"type": ["string", "null"]}, + "singularity_path": {"type": ["string"]}, "bindpaths": {"type": ["string", "null"]}, "updated_at": {"type": "string"}, "module_name": {"type": "string"}, diff --git a/shpc/main/wrappers/templates/singularity/exec.sh b/shpc/main/wrappers/templates/singularity/exec.sh index 3040e3c23..dc618fee9 100644 --- a/shpc/main/wrappers/templates/singularity/exec.sh +++ b/shpc/main/wrappers/templates/singularity/exec.sh @@ -1,4 +1,4 @@ {% extends "bases/shell-script-base.sh" %} -{% block content %}singularity ${SINGULARITY_OPTS} exec ${SINGULARITY_COMMAND_OPTS} {% if features.gpu %}{{ features.gpu }} {% endif %}{% if features.home %}-B {{ features.home }} --home {{ features.home }} {% endif %}{% if features.x11 %}-B {{ features.x11 }} {% endif %}{% if settings.environment_file %}-B $wrapperDir/{{ settings.environment_file }}:/.singularity.d/env/{{ settings.environment_file }}{% endif %} {% if settings.bindpaths %}-B {{ settings.bindpaths }}{% endif %} {% if alias.singularity_options %} {{ alias.singularity_options }} {% endif %} {{ image }} {% if '/sh' in settings.wrapper_shell or '/bash' in settings.wrapper_shell %}"$@"{% elif '/csh' in settings.wrapper_shell %}$argv:q{% endif %} +{% block content %}{{ settings.singularity_path }} ${SINGULARITY_OPTS} exec ${SINGULARITY_COMMAND_OPTS} {% if features.gpu %}{{ features.gpu }} {% endif %}{% if features.home %}-B {{ features.home }} --home {{ features.home }} {% endif %}{% if features.x11 %}-B {{ features.x11 }} {% endif %}{% if settings.environment_file %}-B $wrapperDir/{{ settings.environment_file }}:/.singularity.d/env/{{ settings.environment_file }}{% endif %} {% if settings.bindpaths %}-B {{ settings.bindpaths }}{% endif %} {% if alias.singularity_options %} {{ alias.singularity_options }} {% endif %} {{ image }} {% if '/sh' in settings.wrapper_shell or '/bash' in settings.wrapper_shell %}"$@"{% elif '/csh' in settings.wrapper_shell %}$argv:q{% endif %} {% endblock %} diff --git a/shpc/main/wrappers/templates/singularity/inspect-deffile.sh b/shpc/main/wrappers/templates/singularity/inspect-deffile.sh index 26fafcb7f..59d17c4dd 100644 --- a/shpc/main/wrappers/templates/singularity/inspect-deffile.sh +++ b/shpc/main/wrappers/templates/singularity/inspect-deffile.sh @@ -1,3 +1,3 @@ {% extends "bases/shell-script-base.sh" %} -{% block content %}singularity ${SINGULARITY_OPTS} inspect ${SINGULARITY_COMMAND_OPTS} -d {{ image }}{% endblock %} +{% block content %}{{ settings.singularity_path }} ${SINGULARITY_OPTS} inspect ${SINGULARITY_COMMAND_OPTS} -d {{ image }}{% endblock %} diff --git a/shpc/main/wrappers/templates/singularity/inspect-runscript.sh b/shpc/main/wrappers/templates/singularity/inspect-runscript.sh index 7d8976e73..9b8269519 100644 --- a/shpc/main/wrappers/templates/singularity/inspect-runscript.sh +++ b/shpc/main/wrappers/templates/singularity/inspect-runscript.sh @@ -1,3 +1,3 @@ {% extends "bases/shell-script-base.sh" %} -{% block content %}singularity ${SINGULARITY_OPTS} inspect ${SINGULARITY_COMMAND_OPTS} -r {{ image }}{% endblock %} +{% block content %}{{ settings.singularity_path }} ${SINGULARITY_OPTS} inspect ${SINGULARITY_COMMAND_OPTS} -r {{ image }}{% endblock %} diff --git a/shpc/main/wrappers/templates/singularity/run.sh b/shpc/main/wrappers/templates/singularity/run.sh index 7da8a9da0..7d7cf8072 100644 --- a/shpc/main/wrappers/templates/singularity/run.sh +++ b/shpc/main/wrappers/templates/singularity/run.sh @@ -1,4 +1,4 @@ {% extends "bases/shell-script-base.sh" %} -{% block content %}singularity ${SINGULARITY_OPTS} run ${SINGULARITY_COMMAND_OPTS} {% if features.gpu %}{{ features.gpu }} {% endif %}{% if features.home %}-B {{ features.home }} --home {{ features.home }} {% endif %}{% if features.x11 %}-B {{ features.x11 }} {% endif %}{% if settings.environment_file %}-B $wrapperDir/{{ settings.environment_file }}:/.singularity.d/env/{{ settings.environment_file }}{% endif %} {% if settings.bindpaths %}-B {{ settings.bindpaths }}{% endif %} {% if alias.singularity_options %} {{ alias.singularity_options }} {% endif %} {{ image }} {% if '/sh' in settings.wrapper_shell or '/bash' in settings.wrapper_shell %}"$@"{% elif '/csh' in settings.wrapper_shell %}$argv:q{% endif %} +{% block content %}{{ settings.singularity_path }} ${SINGULARITY_OPTS} run ${SINGULARITY_COMMAND_OPTS} {% if features.gpu %}{{ features.gpu }} {% endif %}{% if features.home %}-B {{ features.home }} --home {{ features.home }} {% endif %}{% if features.x11 %}-B {{ features.x11 }} {% endif %}{% if settings.environment_file %}-B $wrapperDir/{{ settings.environment_file }}:/.singularity.d/env/{{ settings.environment_file }}{% endif %} {% if settings.bindpaths %}-B {{ settings.bindpaths }}{% endif %} {% if alias.singularity_options %} {{ alias.singularity_options }} {% endif %} {{ image }} {% if '/sh' in settings.wrapper_shell or '/bash' in settings.wrapper_shell %}"$@"{% elif '/csh' in settings.wrapper_shell %}$argv:q{% endif %} {% endblock %} diff --git a/shpc/main/wrappers/templates/singularity/shell.sh b/shpc/main/wrappers/templates/singularity/shell.sh index aac4116fa..df695332f 100644 --- a/shpc/main/wrappers/templates/singularity/shell.sh +++ b/shpc/main/wrappers/templates/singularity/shell.sh @@ -1,4 +1,4 @@ {% extends "bases/shell-script-base.sh" %} -{% block content %}singularity ${SINGULARITY_OPTS} shell ${SINGULARITY_COMMAND_OPTS} {% if features.gpu %}{{ features.gpu }} {% endif %}{% if features.home %}-B {{ features.home }} --home {{ features.home }} {% endif %}{% if features.x11 %}-B {{ features.x11 }} {% endif %}{% if settings.environment_file %}-B $wrapperDir/{{ settings.environment_file }}:/.singularity.d/env/{{ settings.environment_file }}{% endif %} {% if settings.bindpaths %}-B {{ settings.bindpaths }}{% endif %} -s {{ settings.wrapper_shell }} {{ image }} +{% block content %}{{ settings.singularity_path }} ${SINGULARITY_OPTS} shell ${SINGULARITY_COMMAND_OPTS} {% if features.gpu %}{{ features.gpu }} {% endif %}{% if features.home %}-B {{ features.home }} --home {{ features.home }} {% endif %}{% if features.x11 %}-B {{ features.x11 }} {% endif %}{% if settings.environment_file %}-B $wrapperDir/{{ settings.environment_file }}:/.singularity.d/env/{{ settings.environment_file }}{% endif %} {% if settings.bindpaths %}-B {{ settings.bindpaths }}{% endif %} -s {{ settings.wrapper_shell }} {{ image }} {% endblock %} diff --git a/shpc/settings.yml b/shpc/settings.yml index d74743824..41df971fc 100644 --- a/shpc/settings.yml +++ b/shpc/settings.yml @@ -57,6 +57,9 @@ default_view: singularity_module: podman_module: +# Path to (or name of) the singularity executable to use in wrapper scripts. Can be used instead of / with singularity_module +singularity_path: singularity + # string with comma separated list of paths to binds. If set, expored to SINGULARITY_BINDPATH bindpaths: From be578c02430a82c4e901912953cd34ae36a99604 Mon Sep 17 00:00:00 2001 From: Matthieu Muffato Date: Thu, 10 Apr 2025 18:09:28 +0100 Subject: [PATCH 3/3] Bumped the version number and updated the changelog --- CHANGELOG.md | 1 + shpc/version.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf893e7c5..357800a16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are: The versions coincide with releases on pip. Only major versions will be released as tags on Github. ## [0.0.x](https://github.com/singularityhub/singularity-hpc/tree/main) (0.0.x) + - Added an option (`singularity_path`) to control the path to the Singularity executable (0.1.31) - Fix `module-info shell` Tcl test for Lmod<=8.7.55 (0.1.30) - Allow import of LooseVersion from packaging (bug) (0.1.29) - use quay.io api to list tags since does not conform to oci (0.1.28) diff --git a/shpc/version.py b/shpc/version.py index 29068d153..740590cd7 100644 --- a/shpc/version.py +++ b/shpc/version.py @@ -2,7 +2,7 @@ __copyright__ = "Copyright 2021-2025, Vanessa Sochat" __license__ = "MPL 2.0" -__version__ = "0.1.30" +__version__ = "0.1.31" AUTHOR = "Vanessa Sochat" EMAIL = "vsoch@users.noreply.github.com" NAME = "singularity-hpc"