2

The package Environment Modules defines the module-info mode command. The man page for modulefile lists the possible modes as:

load, remove, display, help, whatis, switch, switch1, switch2, or switch3.

What are the multiple switch statements?

coatless
  • 20,011
  • 13
  • 69
  • 84
Pete
  • 10,310
  • 7
  • 53
  • 59

1 Answers1

2

Couldn't find this documented anywhere, so I figured it out and want to share with you. Here's my explanation. Consider the following:

module load a
module swap a b

Here's what's executed under the hood by environment modules for each statement:

  1. module load a

    1. [ module-info mode ] == "load" for modulefile a
  2. module swap a b

    1. [module-info mode] == "switch1" for modulefile a. This should unset prereqs and is similar to remove
    2. [module-info mode] == "switch2" for modulefile b. This should add any dependencies. Simliar to "load"
    3. [module-info mode] == "switch3" for modulefile a. Not sure why you'd need this.
Pete
  • 10,310
  • 7
  • 53
  • 59
  • I confess to never having understood the `module` stuff at all. (I don't use it on any of my systems.) Alas, this means I've got no idea whether your answer is right. However, it does sound like a multi-stage swap where there's some sort of transfer of responsibility. Can the state changes fail? If `switch2` can fail, that's a reason to have `switch3` (and that pattern in general)… – Donal Fellows Dec 12 '13 at 21:09