Thanks, Xavier. This will be very useful in my env.
In my case our shell environment is more complicated than it should be
(working on that) and there are some order dependencies in the PATH
definition. I regularly do a "module switch" in order to test new versions
of EDA software or our toolchain. With v4 the only choice would be to
create a new meta-modulefile to select the desired versions and then load
that. It's of course doable, just not as flexible.
Regards,
- Leo
On Fri, Jun 26, 2020 at 12:23 PM Xavier Delaruelle <
xav...@gm...> wrote:
> I have made a ticket to track this need of getting back switch sub-command
> behavior of Modules version 3:
>
> https://github.com/cea-hpc/modules/issues/347
>
> Best regards,
> Xavier
>
> Le ven. 26 juin 2020 à 17:13, Roberto Beccherle <
> Rob...@pi...> a écrit :
>
>> I agree that the new behaviour is much better.
>> Nevertheless i understand that if you have many files that rely on the
>> old behaviour it would be best to have a default option (that can be set by
>> the user, or the modulefiles maintainer for all users using the modules)
>> that has compatibility with the "old" way of dealing with this.
>>
>> Roberto
>>
>> On Fri, Jun 26, 2020 at 2:54 PM Paul FM via Modules-interest <
>> mod...@li...> wrote:
>>
>>> You could add an option to switch/swap to choose this behavior.
>>>
>>> -o (for preserve module order)
>>> -n (for NO preserve module order)
>>> -i (for do it the old inconsistent way)
>>>
>>> Then have something in the config that sets the default.
>>> (and maybe have module -h list the defaults).
>>>
>>> Personally, I like the new behavior (I was not even really aware of the
>>> old behavior). The new behavior is more consistent with what I would
>>> expect.
>>>
>>> There are always going to be some modules which don't unload very well
>>> and if switch were to unload and reload those modules there could be side
>>> effects (like removing something from the environment that was set by
>>> something other than a module).
>>>
>>>
>>> -- On 2020-06-26 1:32 AM, Xavier Delaruelle wrote:
>>> > Hi Leo,
>>> >
>>> > What you encounter is the expected behavior starting version 4. I have
>>> > described this difference of behavior for the switch sub-command on the
>>> > diff doc [1].
>>> >
>>> > The switch in place of version 3 was very specific by replacing
>>> append-path
>>> > of prepend-path entries from the switched-on module at the exact same
>>> place
>>> > entries are removed for the switched-off module. It coped well when
>>> > switching modules which are really close but could lead to
>>> inconsistencies
>>> > when those 2 modules are different, like for instance if you want to
>>> switch
>>> > a compiler by another.
>>> >
>>> > One goal of version 4 is to bring consistency over the module actions,
>>> that
>>> > is why the behavior of the switch sub-command from version 3 has not
>>> been
>>> > ported to version 4.
>>> >
>>> > However it seems possible to have this behavior back if every loaded
>>> > modules after switched-off module are automatically unloaded, then
>>> > switched-on module is loaded and after that every automatically
>>> unloaded
>>> > modules are loaded again. This could be opt-in throught an option to
>>> have
>>> > switch behaves as "switch in place".
>>> >
>>> > Best regards,
>>> > Xavier
>>> >
>>> > [1]
>>> >
>>> https://modules.readthedocs.io/en/latest/diff_v3_v4.html#module-sub-commands
>>> >
>>> > Le jeu. 25 juin 2020 à 02:41, Leo Butler <leo...@gm...> a
>>> écrit :
>>> >
>>> >> Hi Xavier,
>>> >>
>>> >> I think perhaps this question has been asked and answered before but
>>> I've
>>> >> searched the archive and looked in MIGRATING.txt but haven't found
>>> it. If
>>> >> it's a duplicate, my apologies.
>>> >>
>>> >> Using the current version of modules (v4.5.1), loaded module order
>>> isn't
>>> >> preserved. To demonstrate, I set up four modulefiles that look like
>>> this:
>>> >>
>>> >> alpha/1: append-path TEST_VAR alpha1
>>> >> beta/2: append-path TEST_VAR beta2
>>> >> beta/4: append-path TEST_VAR beta4
>>> >> gamma/3: append-path TEST_VAR gamma3
>>> >>
>>> >> % module load alpha beta/2 gamma
>>> >> % module list
>>> >> Currently Loaded Modulefiles:
>>> >> 1) alpha/1 2) beta/2 3) gamma/3
>>> >> % echo $TEST_VAR
>>> >> alpha1:beta2:gamma3
>>> >> % module switch beta/4
>>> >> % module list
>>> >> Currently Loaded Modulefiles:
>>> >> 1) alpha/1 2) gamma/3 3) beta/4
>>> >> % echo $TEST_VAR
>>> >> alpha1:gamma3:beta4
>>> >>
>>> >> With v3.2, the original order is preserved, and I think this is the
>>> >> desired behavior.
>>> >>
>>> >> % module list
>>> >> Currently Loaded Modulefiles:
>>> >> 1) alpha/1 2) beta/4 3) gamma/3
>>> >> % echo $TEST_VAR
>>> >> alpha1:beta4:gamma3
>>> >>
>>> >> Anyone looking to move a modulefile into a different place in the
>>> order
>>> >> could simply do a load followed by an unload. The switch command
>>> seems to
>>> >> just be a proxy for this in v4.x, at least by default.
>>> >>
>>> >> I've looked for something to alter this behavior but I've not found
>>> it.
>>> >> Any suggestions?
>>> >>
>>> >> Thanks,
>>> >>
>>> >> - Leo
>>> >> _______________________________________________
>>> >> Modules-interest mailing list
>>> >> Mod...@li...
>>> >> https://lists.sourceforge.net/lists/listinfo/modules-interest
>>> >>
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > Modules-interest mailing list
>>> > Mod...@li...
>>> > https://lists.sourceforge.net/lists/listinfo/modules-interest
>>> >
>>>
>>> --
>>> --------------------------------------------------------
>>> The views and opinions expressed above are strictly
>>> those of the author(s). The content of this message has
>>> not been reviewed nor approved by any entity whatsoever.
>>> --------------------------------------------------------
>>> Paul FM Info: http://umn.edu/~paulfm/
>>> --------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> Modules-interest mailing list
>>> Mod...@li...
>>> https://lists.sourceforge.net/lists/listinfo/modules-interest
>>>
>> _______________________________________________
>> Modules-interest mailing list
>> Mod...@li...
>> https://lists.sourceforge.net/lists/listinfo/modules-interest
>>
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
>
|