Skip to content

Commit cf4e302

Browse files
authored
Merge pull request #388 from xdelaruelle/improve_modules
Improve tcl/lua module code & test
2 parents a5a0e0a + f031249 commit cf4e302

File tree

16 files changed

+92
-60
lines changed

16 files changed

+92
-60
lines changed

.github/workflows/test-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
run: |
1414
sudo apt-get install lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev
1515
16-
- name: Install LMOD
16+
- name: Install Lmod
1717
run: |
1818
PKG_VERSION=8.4.27
1919
PKG_URL="https://github.com/TACC/Lmod/archive/${PKG_VERSION}.tar.gz"

.github/workflows/test.yml

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515

1616
- name: Install Dependencies
1717
run: |
18-
sudo apt-get install lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev
18+
sudo apt-get install lua5.2 liblua5.2-dev lua-filesystem lua-posix tcl tcl-dev tcsh
1919
20-
- name: Install environment modules
20+
- name: Install Environment Modules
2121
if: ${{ matrix.module == 'tcl' }}
2222
run: |
2323
curl -LJO https://github.com/cea-hpc/modules/releases/download/v4.7.1/modules-4.7.1.tar.gz
@@ -28,7 +28,7 @@ jobs:
2828
make
2929
sudo make install
3030
31-
- name: Install LMOD
31+
- name: Install Lmod
3232
if: ${{ matrix.module == 'lmod' }}
3333
run: |
3434
PKG_VERSION=8.4.27
@@ -54,16 +54,27 @@ jobs:
5454
source activate shpc
5555
pip install -e .
5656
57-
- name: Run python module tests
58-
if: ${{ matrix.module == 'lmod' }}
57+
- name: Run python module tests (bash)
58+
shell: bash
5959
run: |
60+
case "${{ matrix.module }}" in
61+
lmod)
62+
. /usr/share/lmod/lmod/init/bash
63+
;;
64+
tcl)
65+
. /usr/local/Modules/init/bash
66+
shopt expand_aliases || true
67+
shopt -s expand_aliases
68+
;;
69+
esac
70+
6071
export PATH="/usr/share/miniconda/bin:$PATH"
61-
. /usr/share/lmod/lmod/init/sh
6272
source activate shpc
6373
shpc config set container_tech:${{ matrix.container_tech }}
6474
shpc config set module_sys:${{ matrix.module }}
6575
shpc config set enable_tty:false
6676
shpc install python:3.9.5-alpine
77+
6778
module use ./modules
6879
module load python/3.9.5-alpine
6980
alias
@@ -76,24 +87,35 @@ jobs:
7687
7788
printf "\n\nmodule help ============================================\n"
7889
module help python/3.9.5-alpine
79-
python-exec echo donuts
80-
python-run python --version
8190
82-
- name: Run python module tests
83-
if: ${{ matrix.module == 'tcl' }}
84-
shell: bash
91+
python-exec echo donuts >test_output
92+
cat test_output
93+
grep --quiet donuts test_output
94+
95+
python-run python --version >test_output
96+
cat test_output
97+
grep --quiet 'Python 3.9.5' test_output
98+
rm test_output
99+
100+
- name: Run python module tests (tcsh)
101+
shell: tcsh -e {0}
85102
run: |
86-
export PATH="/usr/share/miniconda/bin:$PATH"
87-
. /usr/local/Modules/init/sh
88-
source activate shpc
103+
switch ("${{ matrix.module }}")
104+
case lmod:
105+
source /usr/share/lmod/lmod/init/tcsh
106+
breaksw
107+
case tcl:
108+
source /usr/local/Modules/init/tcsh
109+
breaksw
110+
endsw
111+
112+
source /usr/share/miniconda/etc/profile.d/conda.csh
113+
conda activate shpc
89114
shpc config set container_tech:${{ matrix.container_tech }}
90115
shpc config set module_sys:${{ matrix.module }}
91116
shpc config set enable_tty:false
92117
shpc install python:3.9.5-alpine
93118
94-
shopt expand_aliases || true
95-
shopt -s expand_aliases
96-
97119
module use ./modules
98120
module load python/3.9.5-alpine
99121
alias
@@ -106,5 +128,12 @@ jobs:
106128
107129
printf "\n\nmodule help ============================================\n"
108130
module help python/3.9.5-alpine
109-
python-exec echo donuts
110-
python-run python --version
131+
132+
python-exec echo donuts >test_output
133+
cat test_output
134+
grep --quiet donuts test_output
135+
136+
python-run python --version >test_output
137+
cat test_output
138+
grep --quiet 'Python 3.9.5' test_output
139+
rm test_output

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Singularity HPC is optimized for managing containers in an HPC environment. Currently, this includes
88
module technologies:
99

10-
- [LMOD](https://lmod.readthedocs.io/en/latest/)
10+
- [Lmod](https://lmod.readthedocs.io/en/latest/)
1111
- [Environment Modules](http://modules.sourceforge.net/)
1212

1313
And container technologies:

docs/getting_started/developer-guide.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ use is the following:
309309
Development or Testing
310310
======================
311311

312-
If you first want to test singularity-hpc (shpc) with an LMOD installed in
313-
a container, a ``Dockerfile`` is provided for LMOD, and ``Dockerfile.tcl``
312+
If you first want to test singularity-hpc (shpc) with an Lmod installed in
313+
a container, a ``Dockerfile`` is provided for Lmod, and ``Dockerfile.tcl``
314314
for tcl modules. The assumption is that
315315
you have a module system installed on your cluster or in the container. If not, you
316316
can find instructions `here for lmod <https://lmod.readthedocs.io/en/latest/030_installing.html>`_

docs/getting_started/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Getting Started
55
===============
66

77
Singularity Registry (HPC) is a tool that makes it easy to install containers as
8-
LMOD modules. You can create your own registry entries (e.g., a specification
8+
Lmod modules. You can create your own registry entries (e.g., a specification
99
to pull a particular container and expose some number of entrypoints) or
1010
the library also provides you with a community set.
1111

docs/getting_started/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ $ which shpc
5252

5353
This executable should be accessible by an administrator, or anyone that you want
5454
to be able to manage containers. Your user base will be interacting with your
55-
containers via LMOD, so they do not need access to `shpc`.
55+
containers via Lmod, so they do not need access to `shpc`.
5656
If you are a user creating your own folder of modules, you can add them
5757
to your module path.
5858

@@ -94,7 +94,7 @@ and interacting with your modules.
9494
Environment Modules
9595
-------------------
9696

97-
If you are using `environment modules (tcl) <http://modules.sourceforge.net/>`_
97+
If you are using `Environment Modules (tcl) <http://modules.sourceforge.net/>`_
9898
and you find that your aliases do not expand, you can use `shopt <https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html>`_ to fix this issue:
9999

100100
.. code-block:: console

docs/getting_started/use-cases.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Make sure that lmod knows about the folder
4242
4343
$ module use /opt/lmod/shpc
4444
45-
(And likely if you administer an LMOD install you have your preferred way of
45+
(And likely if you administer an Lmod install you have your preferred way of
4646
doing this). And then you can use your modules just as you would that are provided on
4747
your cluster.
4848

docs/getting_started/user-guide.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ then install a container:
5959
$ shpc install python
6060
6161
Add the modules folder to your lmod (you can run this in a bash profile or
62-
manually, and note that if you want to use environment modules, you need to add
62+
manually, and note that if you want to use Environment Modules, you need to add
6363
``--module-sys tcl``).
6464

6565

@@ -336,7 +336,7 @@ commands. Aliases that are custom to the container are not modified.
336336
Module Software
337337
===============
338338

339-
The default module software is currently LMOD, and there is also support for environment
339+
The default module software is currently Lmod, and there is also support for environment
340340
modules that only use tcl (tcl). If you
341341
are interested in adding another module type, please `open an issue <https://github.com/singularityhub/singularity-hpc>`_ and
342342
provide description and links to what you have in mind. You can either specify the
@@ -513,7 +513,7 @@ You can also install a specific tag (as shown in list).
513513
$ shpc install python:3.9.2-alpine
514514
515515
516-
Note that LMOD is the default for the module system, and Singularity for
516+
Note that Lmod is the default for the module system, and Singularity for
517517
the container technology.
518518
If you don't have any module software on your system, you can now test interacting
519519
with the module via the :ref:`getting_started-development` instructions.
@@ -676,7 +676,7 @@ Test
676676
----
677677

678678
Singularity HPC makes it easy to test the full flow of installing and interacting
679-
with modules. This functionality requires a module system (e.g., LMOD) to be installed,
679+
with modules. This functionality requires a module system (e.g., Lmod) to be installed,
680680
and the assumption is that the test is being run in a shell environment where any
681681
supporting modules (e.g., loading Singularity or Podman) would be found if needed.
682682
This is done by way of extending the exported ``$MODULEPATH``. To run a test, you

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Singularity Registry (HPC)
1313
Singularity Registry HPC (shpc) allows you to install containers as modules.
1414
Currently, this includes:
1515

16-
- `LMOD <https://lmod.readthedocs.io/en/latest/>`_
16+
- `Lmod <https://lmod.readthedocs.io/en/latest/>`_
1717
- `Environment Modules <http://modules.sourceforge.net/>`_
1818

1919
And container technologies:

shpc/main/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
def get_client(quiet=False, **kwargs):
1313
"""
14-
Get a singularity HPC client based on the backend (e.g., LMOD)
14+
Get a singularity HPC client based on the backend (e.g., Lmod)
1515
and container technology (currently just Singularity) of interest.
1616
1717
Parameters

0 commit comments

Comments
 (0)