Closed ben-bowers closed 2 years ago
Thanks for the report. What you observe is the current expected behavior for these reload/refresh commands: an error is returned and nothing happens if current loaded environment is seen inconsistent. This is done not to worsen the bad situation the user is currently in.
Dependency cycles should be avoided. load or unload cope well with them but as a result the first loaded module is seen inconsistent as its requirement is loaded after it and not before it.
I am interested to get a concrete use case example where a dependency cycle is needed.
I am interested to get a concrete use case example where a dependency cycle is needed.
This mutual dependency can usually be worked-around either by:
Hi @xdelaruelle I am not sure there is a "concrete use case", but more accurately multiple use cases (and a 3+ node cycle) that involved different users trying to use modules a slightly different way with a different entry point (but net result was trying to load A,B,C in some sequence)
I have been told that they intend to remove the cycle and so I am fine with closing this issue, or could be left as a case of improving documentation.
Hi @ben-bowers I will add mention of this in the documentation, so the issue can be left open for the moment.
Describe the bug
If modulefiles contain a "cycle" where one modulefile
prereq
s another modulefile that also does aprereq
, a cycle is created and cannot be resolved by eitherreload
orrefresh
. A standardmodule load
does not apparently have an issue with breaking the circular dependency.Why would one wish to have a cycle? In the case where some modulefile may want to load settings from another modulefile, but it is uncertain which modulefile the user would load. For example if doing
module load AB
, then also prereq fileBA
. If doingmodule load BA
, then also prereq fileAB
.To Reproduce
Steps to reproduce the behavior:
Location and content of any modulerc or modulefile involved:
Expected behavior
Ideally both reload and refresh could break the cycle and not fail to execute. I do not understand the internals of modules (or what breadcrumbs are saved in the environment) well enough to know if this is possible.
If this is not possible, is there a suggested workaround for this limitation?
Error and debugging information
Using debug mode enough output is printed to help me diagnose that some cycle was found, which presumably is the root issue.
Modules version and configuration
Additional context