modules
modules copied to clipboard
Conflict Unload: remove multiple loaded modules matching one conflict constraint
Something weird we stumbled upon in 4.2.1 in this regard module use ~/modules module add python module add python/3.6.0 module add mymodule Loading mymodule ERROR: mymodule cannot be loaded due to a conflict. HINT: Might try "module unload python" first.
cat ~/modules/mymodule #%Module1.0 module rm python
At the point mymodule is added, python/3.5.0 and python/3.6.0 are present.
Originally posted by @wenzler in https://github.com/cea-hpc/modules/issues/198#issuecomment-452640010
There is no conflict declaration in the python
modulefiles. it simply prepend path stuff in there but as soon as there are several versions of the same software loaded mymodule
breaks it
I see that both modules have a setenv pythonPATH /app/python/version in them Could this be the cause?
Other than that just prepend-path statements as said
Issue comes from the 2 python
modules loaded. module rm python
is now seen like a conflict statement. So when mymodule
is loaded it unloads python
module if loaded. But in your case there are 2 python
modules, so when mymodule
finishes unloading 1 there is still 1 python
module loaded.
As conflicts are now handled consistently, the load of mymodule
produces the error you got because there is still 1 python
module loaded.
I would suggest to ensure only one python
module is loaded at a time.
Also, to get same behavior than on version 4.1, use `--force`` command line switch:
module load --force mymodule
Sorry, but depending on the hierarchy this is pretty much a deal breaker ... for the user experience. Taking python for example: you will want a python 3 and a python 2 - due to script compatibility. There are probably a gazillion similar situations where different branches of the same "software" are loaded simultaneously. Considering this a conflict is imho wrong. There is a well defined unload order after all.
Btw after a forced load another module add python/xxx gets a conflict message towards mymodule leaving module switch in mymodule as the only viable option
I get it, there is a need to simultaneously have multiple python
modules loaded.
So the module rm python
in mymodule
cannot obtain a consistent situation as module rm
only removes one loaded module at a time.
It was already the case with the previous version of Modules: in the example you describe after the load of mymodule
there were still one python
module loaded, which is not consistent with the requirement mymodule
described.
One workaround way to go (but I do not like it, just to solve your issue with the current release) is to update the module rm
statement with multiple python
name:
module rm python python
On the long run, I wonder the need of this module rm python
statement in mymodule
as you do not want a conflict between it and the python
modules and this rm
order is not satisfied when multiple python modules are loaded at the same time.
They actually just wanted to remove just one python of the two I wouldnt ever want such unprecise module rm statement ... but you know people
I have improved the situation a bit with the fix for #216. Now in case a conflict constraint toward a modulefile is set by an already loaded modulefile, loading the conflicting modulefile will lead to a load evaluation attempt in order for this modulefile to get the chance to solve the constraint violation. If at the end of the load evaluation, the conflict has not been solved, modulefile load will be discarded.
However mymodule
will still get an issue at load time if there are multiple python modules loaded (1 will be automatically unloaded, but as there is 1 remaining a consistency error will raise). This error indicates to the user what he/she wants to do lead to an inconsistent environment (based on what modulefiles declare). He/she can by-pass that error with the --force
command-line switch.
Auto handling mechanisms cannot do better at the moment as no conflict unload is performed. This upcoming Conflict Unload mechanism should unload all the loaded modules matching a conflict definition to improve the situation here.