I am setting up Environment Modules for a server and have two modules: test1 and test2.

Test1 needs java 1.7.0 and test2 needs java 1.8.0. If I use prereqs/conflicts, as seems to be standard practice, then I must load java 1.7.0 before loading test1 but if I load test2 afterwards and module switch java to 1.8.0, test1 remains loaded and may still be functional in a warped manner.

The user, of course, has to do the module switch themselves but is there any way to avoid this scenario so that test1 is unloaded if its prereq is. It may be fairly easy to keep track of in the above scenario but if there are lots of tools each with multiple dependencies I expect problems to arise. Is there some functionality of environment modules I'm not aware of or misunderstanding?

  • Welcome to U&L. I'm not clear on what you mean by modules here. Are you talking about different Java applications? Because you can have multiple Java installations on a system, and you can run multiple JVMs off of those. Each JVM is isolated. – Haxiel Feb 15 at 12:54
  • Thanks! Java is just an example, perhaps a poor one because of JVM. I'm referring to this modules.sourceforge.net/index.html. In my example I'd have a modulefile for test1 and a modulefile for test2 (as well as one for Java 1.7.0 and 1.8.0). As a user I load the modulefile for test1 which requires I load the modulefile for Java 1.7.0, which I do, then because I want to use test2 I use load the modulefile for Java 1.8.0. Upon doing this my test1 tool may become dysfunctional but as a user I am not aware of this and I want to know how to prevent this scenario arising, as an administrator. – Tobi Feb 15 at 13:10
  • I'm not really familiar with that project, sorry. Based on what I saw in the documentation, it seems to be concerned about changing your shell environment. I am not sure how or even if that would have an effect on applications that are already running. – Haxiel Feb 15 at 13:29
  • Typical use case is you change your shell environment to make only certain tools available at once to the user e.g. module load java will append the bin for Java to your path, set JAVA_DIR and JAVA_HOME, etc. My problem arises from dependency clashes e.g. because tool2 needs Java 1.8.0, module switch removes Java 1.7.0's bin from my path and adds Java 1.8.0's bin. But then because tool1 is still 'loaded' (i.e. present in my path) when I call tool1 it will use Java 1.8.0 and possibly break or worse have silent, altered performance. – Tobi Feb 15 at 13:39
  • Sorry - the comment above should say test1 and test2 instead of tool1 and tool2. Thank you for attempting to help. – Tobi Feb 15 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.