File: evaluation-errors.rst

package info (click to toggle)
modules 5.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,036 kB
  • sloc: exp: 79,659; sh: 6,142; tcl: 5,900; makefile: 1,492; ansic: 474; python: 265; csh: 202; perl: 47; ruby: 44; lisp: 13
file content (413 lines) | stat: -rw-r--r-- 14,740 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
.. _evaluation-errors:

Evaluation errors
=================

This document describes the different evaluation errors, depending on the
evaluation modes. The obtained behaviors when these errors raise and the
configuration options or command-line switches that change these behaviors.

Error kinds
-----------

The following list describes the different kind of evaluation error:

* *bad code*: modulefile has some code error (e.g., bad Tcl syntax, using
  undefined commands)
* *break*: use of ``break`` Tcl command in modulefile
* *exit*: use of ``exit`` Tcl command in modulefile
* *error*: use of ``error`` Tcl command in modulefile
* *not found*: designated modulefile cannot be found
* *hard hidden*: designated modulefile is hidden in ``--hard`` mode and cannot
  be found
* *not loaded*: when unloading a module, designated modulefile is not found
  loaded
* *already loaded*: when loading a module, designated modulefile is already
  loaded
* *conflict*: dependency issue where loading modulefile conflicts with at
  least one loaded module
* *missing requirement*: dependency issue where a loading modulefile has at
  least one requirement module not loaded
* *dependent reload*: dependency issue where a loading or unloading modulefile
  has at least one dependent module that fails to reload (either during the
  unload or load phase)
* *unloading dependent*: dependency issue where an unloading modulefile has at
  least one loaded module requiring it
* *forbidden*: evaluated modulefile is tagged forbidden
* *sticky unload*: when unloading a module tagged sticky
* *super-sticky unload*: when unloading a module tagged super-sticky
* *dependent sticky reload*: *dependent reload* special case where a sticky
  dependent module fails to reload (during the load phase)
* *dependent super-sticky reload*: *dependent reload* special case where a
  super-sticky dependent module fails to reload (during the load phase)

.. note:: Use of ``continue`` Tcl command in modulefile shortens evaluation
   but it is not considered an error.

.. note:: When a *dependent reload* issue occurs during the load or unload of
   a modulefile, the dependent module failing to reload has raised one of the
   following error kind: bad code, break, exit, error, conflict, missing
   requirement, forbidden or hard hidden.

Behavior when error raises
--------------------------

This section describes the behaviors generally obtained when the different
error kinds raise.

Other specific behavior depending on evaluation mode or configuration options
are described in the following parts of the document.

.. _default:

Default
^^^^^^^

Default behavior when an error raises:

* current modulefile evaluation is aborted
* an error message is reported
* exit code is set to 1

Ignored errors
^^^^^^^^^^^^^^

The following error kinds are *ignored errors*:

* not loaded
* already loaded

These errors lead to a different behavior:

* current modulefile evaluation is skipped
* no message reported
* no error exit code set

Errors raised during modulefile evaluation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Following errors are raised during the Tcl evaluation of a modulefile:

* bad code
* break
* exit
* error
* conflict (also raised outside modulefile evaluation)
* missing requirement

Evaluation mode or options specific behaviors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some error kinds only occur during specific evaluation mode or when
configuration options are set to a given value.

+---------------------+------------+-------------------------------+
| Error kind          | Evaluation | Configuration option          |
|                     | mode       |                               |
+=====================+============+===============================+
| conflict            | load       |                               |
+---------------------+------------+-------------------------------+
| missing requirement | load       |                               |
+---------------------+------------+-------------------------------+
| dependent reload    | load,      |                               |
|                     | unload     |                               |
+---------------------+------------+-------------------------------+
| unloading dependent | unload     | when :mconfig:`auto_handling` |
|                     |            | is disabled                   |
+---------------------+------------+-------------------------------+
| forbidden           | load       |                               |
+---------------------+------------+-------------------------------+
| hard hidden         | load       |                               |
+---------------------+------------+-------------------------------+
| already loaded      | load       |                               |
+---------------------+------------+-------------------------------+
| not loaded          | unload     |                               |
+---------------------+------------+-------------------------------+
| sticky unload       | unload     |                               |
+---------------------+------------+-------------------------------+
| super-sticky unload | unload     |                               |
+---------------------+------------+-------------------------------+
| dependent sticky    | load       |                               |
| reload              |            |                               |
+---------------------+------------+-------------------------------+
| dependent           | load       |                               |
| super-sticky reload |            |                               |
+---------------------+------------+-------------------------------+

When evaluation mode and/or configuration option matches for these error kinds
to raise, a :ref:`default error behavior<default>` error behavior is applied.

Load sub-command
----------------

Specific error behavior for modulefile load evaluation by :subcmd:`load`
sub-command.

Force mode
^^^^^^^^^^

When :option:`--force` command-line switch is used, load evaluation by-pass
following errors:

* conflict
* missing requirement
* dependent reload
* dependent sticky reload

Following behavior is observed:

* evaluation continues (error is by-passed)
* warning message reported (instead of an error message)
* no error exit code set

.. warning:: *Missing requirement* and *dependent reload* errors currently
   returns an error exit code. This behavior might be aligned with the above
   one in the future. Or the above behavior may be adapted the other way
   around.

No effect on other error kinds as it is not useful to mark loaded a broken or
nonexistent modulefile.

``abort_on_error`` configuration option is ignored when ``--force`` option is
in use. Which means *continue on error* behavior is applied.

*Abort on error* behavior is applied whatever the value of
:mconfig:`abort_on_error` if following kind of error occurs:

* dependent sticky reload and force mode is disabled.
* dependent super-sticky reload

Multiple modulefiles passed as argument
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When multiple modulefiles are passed to the ``load`` sub-command for
evaluation. If the evaluation of one modulefile raises an error, behavior for
this error is applied and if:

* :mconfig:`abort_on_error` configuration option does not contain ``load`` or
  ``--force`` is set:

  * already evaluated modulefiles from the argument list are kept loaded
  * in case of an *exit* error, evaluation stops
  * for other kind of error, evaluation continues with next modulefile in
    argument list

* :mconfig:`abort_on_error` configuration option contains ``load`` and
  ``--force`` is not set:

  * already evaluated modulefiles from the argument list are withdrawn (they
    will not appear loaded and their environment changes are flushed)
  * evaluation stops

The above description only applies to ``load`` sub-command executed from the
top level context and not from a modulefile evaluation. Multiple arguments on
a ``module load`` command in modulefile are evaluated independently as an
*AND* requirement list.

.. warning:: :command:`ml` command applies the ``abort_on_error`` behavior by
   default, whatever behavior is configured for ``load``. Default behavior for
   ``load`` may be changed in next major version to align ``ml`` command
   behavior.

Load-any sub-command
--------------------

Specific error behavior for modulefile load evaluation by :subcmd:`load-any`
sub-command.

Following errors are ignored:

* not found
* forbidden
* hard hidden

However if no module is loaded after evaluating all ``load-any`` modulefile
arguments:

* an error message is reported
* an error exit code is set

For other kind of error, relative error message is reported and error exit
code is set. Even if a module is loaded after evaluating all modulefile
arguments.

Force mode
^^^^^^^^^^

Same force behavior observed than for `Load sub-command`_.

Multiple modulefiles passed as argument
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

:subcmd:`load-any` stops evaluation process as soon as a modulefile argument
is successfully loaded.

``load-any`` is not a valid value element for :mconfig:`abort_on_error`
configuration option.

*exit* error stops evaluation of remaining modulefiles in the argument list.

When ``module load-any`` is evaluated as a modulefile command:

* if one modulefile in the list is loaded

  * no error message is reported whatever the error kind

* if no modulefile in the list is loaded

  * an error message is reported for errors other than *not found*,
    *forbidden* and *hard hidden*
  * modulefile declaring the ``module load-any`` command raises a *missing
    requirement* error

.. warning:: An error message may also be reported for *not found*,
   *forbidden* and *hard hidden* error in the future when no modulefile in the
   list is loaded.

.. warning:: Error messages may be transformed into warnings and exit code may
   be untouched in the future if one modulefile in the list is loaded.

Try-load sub-command
--------------------

Specific error behavior for modulefile load evaluation by :subcmd:`try-load`
sub-command.

Following errors are ignored:

* not found
* forbidden
* hard hidden

Even if no module is loaded after evaluating all ``try-load`` modulefile
arguments.

Force mode
^^^^^^^^^^

Same force behavior observed than for `Load sub-command`_.

Multiple modulefiles passed as argument
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Same multiple modulefile arguments behavior is observed than for `Load
sub-command`_.

Except *not found*, *forbidden* and *hard hidden* errors are ignored even if
:mconfig:`abort_on_error` configuration option contains ``try-load``.

Mod-to-sh sub-command
---------------------

Specific error behavior for modulefile load evaluation by :subcmd:`mod-to-sh`
sub-command.

Same behavior is observed than for `Load sub-command`_.

Reload sub-command
------------------

Specific error behavior for modulefile load evaluation by :subcmd:`reload`
sub-command.

In case of any error (either during unload or load phase) evaluation stops and
environment changes of already unloaded/loaded modules are flushed. Unless if
force mode is enabled or if reload is removed from :mconfig:`abort_on_error`
configuration option (where it is enabled by default). In this case, a
*continue on error* behavior is applied.

*Abort on error* behavior is applied whatever the value of
:mconfig:`abort_on_error` if:

* a sticky module is not able to reload and force mode is disabled.
* a super-sticky module is not able to reload

Prior running evaluations, dependencies of loaded modules are checked. If at
least one dependency (requirement or conflict) is not satisfied, an error is
raised.

Purge sub-command
------------------

Specific error behavior for modulefile load evaluation by :subcmd:`purge`
sub-command.

In case of error, *continue on error* behavior is applied. If purge is added
in the value list of :mconfig:`abort_on_error` configuration option and if
force mode is not set, *abort on error* behavior applies.

Unload sub-command
------------------

Specific error behavior for modulefile unload evaluation by :subcmd:`unload`
sub-command.

Force mode
^^^^^^^^^^

When :option:`--force` command-line switch is used, unload evaluation by-pass
following errors:

* bad code
* break
* exit
* error
* dependent reload
* unloading dependent
* sticky unload
* dependent sticky reload

Following behavior is observed:

* evaluation continues (error is by-passed)
* warning message reported (instead of an error message)
* no error exit code set

When facing an erroneous modulefile, it seems useful to be able to get rid of
it from user's loaded environment.

``abort_on_error`` configuration option is ignored when ``--force`` option is
in use. Which means *continue on error* behavior is applied.

*Abort on error* behavior is applied whatever the value of
:mconfig:`abort_on_error` if following kind of error occurs:

* dependent sticky reload and force mode is disabled.
* dependent super-sticky reload

Multiple modulefiles passed as argument
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When multiple modulefiles are passed to the ``unload`` sub-command for
evaluation. If the evaluation of one modulefile raises an error, behavior for
this error is applied and if:

* :mconfig:`abort_on_error` configuration option does not contain ``unload``
  or ``--force`` is set:

  * already evaluated modulefiles from the argument list are kept unloaded
  * for other kind of error, evaluation continues with next modulefile in
    argument list

* :mconfig:`abort_on_error` configuration option contains ``load`` and
  ``--force`` is not set:

  * already evaluated modulefiles from the argument list are withdrawn (they
    will appear loaded again and their environment changes are untouched)
  * evaluation stops

The above description only applies to ``unload`` sub-command executed from the
top level context and not from a modulefile evaluation. Multiple arguments on
a ``module unload`` command in modulefile are evaluated independently as an
*AND* conflict list.

.. warning:: :command:`ml` command applies an abort behavior when facing an
   error. Evaluation stops and already unloaded modulefiles are restored in
   loaded environment. It may be changed in the next major version to align
   unload phase of ``ml`` command on ``unload`` sub-command behavior.

.. note:: *exit* error does not lead to an evaluation inhibit of remaining
   modulefiles when evaluation is made in unload mode. Unless if an exit error
   was previously raised in a load evaluation mode prior an unload phase.

.. vim:set tabstop=2 shiftwidth=2 expandtab autoindent: