Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added an option to configure the path to singularity directly
  • Loading branch information
muffato committed Apr 9, 2025
commit 12e547a7501944501a63570699abcbf13921dff6
2 changes: 2 additions & 0 deletions docs/getting_started/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ variable replacement. A summary table of variables is included below, and then f
* - 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