Hello Xavier,
Thank you for the explanation!
Will this feature be available in Lmod as well sometime in the future? Unfortunately, the systems I am working on have Lmod 8.5.2 installed, which doesn't seem to support this feature.
regards,Daniel
On Wednesday, April 13, 2022, 10:34:15 PM MDT, Xavier Delaruelle <xav...@gm...> wrote:
Hello Daniel,
Starting Modules 4.1, regular puts statement are run right after environment changes, so the load phase in your example should perform just fine:
$ cat foo
#%Module
append-path PATH /path/to/foo
puts "echo foo;"
$ $MODULES_CMD bash load ./foo
PATH=usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/path/to/foo; export PATH;
_LMFILES_=/home/user/foo; export _LMFILES_;
LOADEDMODULES=/home/user/foo; export LOADEDMODULES;
echo foo;
test 0;
For the unload phase, a new channel called prestdout is introduced to render puts statement prior environment changes as the deactivate command has to be done prior unsetting path. This is a new feature that will be introduced in upcoming version 5.1 [1].
Regards,Xavier
[1] https://modules.readthedocs.io/en/latest/modulefile.html#mfcmd-puts
Le jeu. 14 avr. 2022 à 03:20, daniel shawul via Modules-interest <mod...@li...> a écrit :
Is it possible to update PATHs immediately after a module load call inside a modulefile. For the example shown below, a module named mymodule, the first call of module load mymodule will load conda but the following conda activate call will not work because path to conda exe is not found. The second call does the activate just fine, so what I am trying to achieve is to get the conda activate to work with one module load call. I've tried getting the path to the conda exe and calling conda activate with it, but didn't work.
The only thing that seems to work is to put them in two separate modulefiles.
#%Module
module load miniconda3
if { [module-info mode load] } {
puts "conda activate mywork;"
}
if {[module-info mode remove]} {
puts "conda deactivate;"
}
_______________________________________________
Modules-interest mailing list
Mod...@li...
https://lists.sourceforge.net/lists/listinfo/modules-interest
|