Files
Wirawan Purwanto 5edd528511 * Saved a sample revised ipython module loader, to be used with
"fix3" version of lmod_python_fix.py.

  Sigs:
    # -rw------- 1 wpurwant users 291 2020-06-09 20:09 000-odurc-lmod.py.rev3
    # 70e84e7eaaf28da297fa342c8318fe2b  000-odurc-lmod.py.rev3
2022-02-22 11:23:54 -05:00
..

Date: 2020-06-09

Purpose: troubleshoot & fix the ipython startup file
which caused issue.

The original setup (combined `000-odurc-lmod.py` and `lmod_python.py`)
have several issues:

* On Turing (vanilla ipython), could not find the module command.

* On Wahab (vanilla ipython), invoking the "module" command resulted
  in an error due to unset `LMOD_MANUAL_LD_LIBRARY_PATH` env var.

* On Wahab/OOD, the "module" command messed up all the symlinks in the
  specially prepared library dir (LMOD_MANUAL_LD_LIBRARY_PATH).
  As a result, all symlinks become circular links.

I fixed these files with the following improvements:

1) Allow the setup to work on both Wahab and Turing. (The new
   `lmod_python.py` needs to be installed somewhere on Turing;
   I made up the location to be
   `/cm/shared/applications/lmod/lmod/scripts/init`.

2) Fix the indefinite lengthening of `sys.path` as a result of
   "module" command invocation: now only the *changes* are updated
   onto `sys.path`. Still not perfect (see notes in the Python code)
   but should work ok for most cases.

3) As a result of fix #2 above, when we invoke `module("unload",
   A_MODULE)`, the paths associated with `A_MODULE` will also be removed.

4) Fix the "circular links" problem. If `LMOD_MANUAL_LD_LIBRARY_PATH`
   is not specified, it quietly ignores the symlink update process.

See if you like these changes---I suggest implementing them soon.

I found that the existing `000-odurc-lmod.py` is always overwritten
whenever I launch Jupyter on Wahab OOD. It was due to `before.sh` of
the OOD Jupyter notebook setup ... grrr. I know you assume that users
won't mess with this file (but I did, while doing all this testing).
I'll make my own workaround.