Skip to content

Commit cf46fc1

Browse files
committed
doc: desc. provide and provided-alias in MIGRATING
Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent 9e0940f commit cf46fc1

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

MIGRATING.rst

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,121 @@ single quotes rather escaping each special characters:
113113
line
114114
value'; export BAR;
115115
116+
Declare additional elements provided by a module
117+
------------------------------------------------
118+
119+
New :mfcmd:`provide` modulefile command is added to declare additional
120+
elements included in a modulefile. When the modulefile is loaded, each
121+
argument specified in the :mfcmd:`provide` command is registered as an alias
122+
for the module.
123+
124+
125+
.. parsed-literal::
126+
127+
:ps:`$` module show foo
128+
-------------------------------------------------------------------
129+
:sgrhi:`/path/to/modulefiles/mp4/foo/1`:
130+
131+
:sgrcm:`provide` liba/1.2 libb/2.1
132+
:sgrcm:`conflict` foo
133+
:sgrcm:`conflict` liba libb
134+
-------------------------------------------------------------------
135+
:ps:`$` module load foo
136+
137+
It is advised to define :mfcmd:`conflict` over the name of these additional
138+
elements to ensure only one provider is found loaded in user environment.
139+
140+
.. parsed-literal::
141+
142+
:ps:`$` module show bar/1
143+
-------------------------------------------------------------------
144+
:sgrhi:`/path/to/modulefiles/bar/1`:
145+
146+
:sgrcm:`provide` liba/1.2 libb/2.1
147+
:sgrcm:`conflict` bar
148+
:sgrcm:`conflict` liba libb
149+
-------------------------------------------------------------------
150+
:ps:`$` module load bar
151+
Loading :sgrhi:`bar/1`
152+
:sgrer:`ERROR`: Module cannot be loaded due to a conflict.
153+
HINT: Might try "module unload foo/1" first.
154+
155+
Once a module with a provided alias is loaded, it fulfills any requirements
156+
declared by other modules for that name and version, just like any other type
157+
of module alias.
158+
159+
.. parsed-literal::
160+
161+
:ps:`$` module show qux
162+
-------------------------------------------------------------------
163+
:sgrhi:`/path/to/modulefiles/qux/1`:
164+
165+
:sgrcm:`prereq` liba/1.2
166+
-------------------------------------------------------------------
167+
:ps:`$` module load qux
168+
:ps:`$` module list
169+
Currently Loaded Modulefiles:
170+
1) foo/1 2) qux/1
171+
172+
Module aliases defined via the :mfcmd:`provide` command are not available
173+
during module resolution, as modulefiles are not evaluated in that context.
174+
Therefore, it is recommended to define a global module alias in a ``modulerc``
175+
file using the :mfcmd:`module-alias` command to specify a default target for
176+
the alias.
177+
178+
.. parsed-literal::
179+
180+
:ps:`$` cat /path/to/modulefiles/.modulerc
181+
#%Module
182+
module-alias liba/1.2 bar/1
183+
:ps:`$` module purge
184+
:ps:`$` module load qux
185+
Loading :sgrhi:`qux/1`
186+
:sgrin:`Loading requirement`: bar/1
187+
188+
The :mfcmd:`provide` modulefile command also serves as an alias for the
189+
:mfcmd:`extensions` command, ensuring compatibility with modulefiles written
190+
for `Lmod`_.
191+
192+
By default an :subcmd:`avail` command includes module aliases defined in
193+
``modulerc`` files. To also get aliases defined within modulefiles with
194+
:mfcmd:`provide` or :mfcmd:`family`, output element ``provided-alias`` has to
195+
be included. It is supported on :mconfig:`avail_output`,
196+
:mconfig:`avail_terse_output`, :mconfig:`spider_output` and
197+
:mconfig:`spider_terse_output` configuration options.
198+
199+
Having ``provided-alias`` included in output triggers :ref:`Extra match
200+
search` mechanism that scans all modulefiles to find these aliases. It is thus
201+
advised to have :ref:`Module cache` built and used to improve search speed.
202+
203+
.. parsed-literal::
204+
205+
:ps:`$` module avail
206+
--------------------- :sgrdi:`/path/to/modulefiles` ---------------------
207+
bar/1 foo/1 :sgrali:`liba/1.2` qux/1
208+
209+
Key:
210+
:sgrdi:`modulepath` :sgrali:`module-alias`
211+
:ps:`$` module avail -o +provided-alias
212+
--------------------- :sgrdi:`/path/to/modulefiles` ---------------------
213+
bar/1 foo/1 :sgrali:`liba/1.2` :sgrali:`libb/2.1` qux/1
214+
215+
Key:
216+
:sgrdi:`modulepath` :sgrali:`module-alias`
217+
218+
The ``provided-alias`` :ref:`Extra specifier` is also introduced to find
219+
modules that define such alias with :mfcmd:`provide` or :mfcmd:`family`
220+
modulefile commands.
221+
222+
.. parsed-literal::
223+
224+
:ps:`$` module avail provided-alias:liba/1.2
225+
--------------------- :sgrdi:`/path/to/modulefiles` ---------------------
226+
bar/1 foo/1
227+
228+
Key:
229+
:sgrdi:`modulepath`
230+
116231
117232
v5.5
118233
====

0 commit comments

Comments
 (0)