Skip to content

Added an option to define the path of the singularity executable #689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions docs/getting_started/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should podman module be here? The singularity path addition is fantastic - great for security too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I noticed it was missing from the doc and thought I'd squeeze that in :)

- 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 }}'``
Expand Down
1 change: 1 addition & 0 deletions shpc/main/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
2 changes: 1 addition & 1 deletion shpc/main/wrappers/templates/singularity/exec.sh
Original file line number Diff line number Diff line change
@@ -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 %}
Original file line number Diff line number Diff line change
@@ -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 %}
Original file line number Diff line number Diff line change
@@ -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 %}
2 changes: 1 addition & 1 deletion shpc/main/wrappers/templates/singularity/run.sh
Original file line number Diff line number Diff line change
@@ -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 %}
2 changes: 1 addition & 1 deletion shpc/main/wrappers/templates/singularity/shell.sh
Original file line number Diff line number Diff line change
@@ -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 %}
3 changes: 3 additions & 0 deletions shpc/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion shpc/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]"
NAME = "singularity-hpc"
Expand Down