Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robert McLay
committed
Jul 17, 2017
1 parent
e2c5278
commit dd992a8
Showing
20 changed files
with
296 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
Dependent Modules | ||
================= | ||
|
||
Let's assume that module "X" depends on module "A". There are several | ||
ways to handle module dependency. Inside the "X" modulefile you could | ||
have one of the following choices: | ||
|
||
#. Use ``prereq("A")`` | ||
#. Use ``load("A")`` | ||
#. Use ``always_load("A")`` | ||
#. Use ``if (not isloaded("A")) then load("A") end`` | ||
#. Use ``if (not isloaded("A")) then always_load("A") end`` | ||
#. Use ``depends_on("A")`` | ||
|
||
Let's examine these choices in order. The main issue for each of | ||
these choices is what happens when module "X" is unloaded. | ||
|
||
``prereq("A")`` | ||
~~~~~~~~~~~~~~~ | ||
|
||
This choice is the one you give for sophisticated users. If a user | ||
tried to load module "X" without previously loading "A" then the user | ||
will get a message telling the user that they must load "A" before | ||
loading "X". This way the dependency is explicitly handled by the | ||
user. When the user unloads "X", module "A" will remain loaded. | ||
|
||
|
||
``load("A")`` | ||
~~~~~~~~~~~~~ | ||
|
||
This choice will always load module "A" on the users behalf. This is | ||
true even if "A" is already loaded. When module "X" is unloaded, | ||
module "A" will be unloaded as well. | ||
|
||
|
||
``always_load("A")`` | ||
~~~~~~~~~~~~~~~~~~~~ | ||
|
||
This choice will always load module "A" on the users behalf. This is | ||
true even if "A" is already loaded. When module "X" is unloaded, | ||
module "A" will remain loaded. | ||
|
||
``if (not isloaded("A")) then load("A") end`` | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
This choice will load module "A" on the users behalf if it not already | ||
loaded. When module "X" is unloaded, module "A" will be unloaded as | ||
well. | ||
|
||
``if (not isloaded("A")) then always_load("A") end`` | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
This choice will load module "A" on the users behalf if it not already | ||
loaded. When module "X" is unloaded, module "A" will remain loaded. | ||
|
||
|
||
``depends_on("A")`` | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
This choice loads module "A" on the users behalf if it not already | ||
loaded. When module "X" is unloaded, module "A" will be unloaded if it | ||
is a dependent load. Imagine the following scenario with | ||
depends_on("A"):: | ||
|
||
$ module purge; module load X; module unload X => unload A | ||
$ module purge; module load A; module load X; module unload X => keep A | ||
|
||
Note that Lmod *does not* know that if both module "X" and "Y" depend | ||
on "A". So if a user loads both "X" and "Y" and then unloads "X", | ||
module "A" will be unloaded unless the user has explicitly load "A" on | ||
the command line. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
-- -*- lua -*- | ||
local testName = "depends_on" | ||
|
||
testdescript = { | ||
owner = "rtm", | ||
product = "modules", | ||
description = [[ | ||
"depends_on" | ||
]], | ||
keywords = {testName }, | ||
|
||
active = true, | ||
testName = testName, | ||
job_submit_method = "INTERACTIVE", | ||
|
||
runScript = [[ | ||
. $(projectDir)/rt/common_funcs.sh | ||
unsetMT | ||
initStdEnvVars | ||
export MODULEPATH=$(testDir)/mf/Core | ||
rm -fr _stderr.* _stdout.* err.* out.* .lmod.d | ||
runLmod --version # 1 | ||
runLmod load A C # 2 | ||
runLmod list # 3 | ||
runLmod unload C # 4 | ||
runLmod list # 5 | ||
HOME=$ORIG_HOME | ||
cat _stdout.[0-9][0-9][0-9] > _stdout.orig | ||
joinBase64Results -bash _stdout.orig _stdout.new | ||
cleanUp _stdout.new out.txt | ||
cat _stderr.[0-9][0-9][0-9] > _stderr.orig | ||
cleanUp _stderr.orig err.txt | ||
rm -f results.csv | ||
wrapperDiff --csv results.csv $(testDir)/out.txt out.txt | ||
wrapperDiff --csv results.csv $(testDir)/err.txt err.txt | ||
testFinish -r $(resultFn) -t $(runtimeFn) results.csv | ||
]], | ||
|
||
|
||
blessScript = [[ | ||
# perform what is needed | ||
]], | ||
|
||
tests = { | ||
{ id='t1'}, | ||
}, | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
=========================== | ||
step 1 | ||
lua ProjectDIR/src/lmod.in.lua bash --regression_testing --version | ||
=========================== | ||
Modules based on Lua: Version 7.5.11 2017-07-13 12:46 -05:00 | ||
by Robert McLay mclay@tacc.utexas.edu | ||
=========================== | ||
step 2 | ||
lua ProjectDIR/src/lmod.in.lua bash --regression_testing load A C | ||
=========================== | ||
=========================== | ||
step 3 | ||
lua ProjectDIR/src/lmod.in.lua bash --regression_testing list | ||
=========================== | ||
Currently Loaded Modules: | ||
1) A 2) B 3) C | ||
=========================== | ||
step 4 | ||
lua ProjectDIR/src/lmod.in.lua bash --regression_testing unload C | ||
=========================== | ||
=========================== | ||
step 5 | ||
lua ProjectDIR/src/lmod.in.lua bash --regression_testing list | ||
=========================== | ||
Currently Loaded Modules: | ||
1) A |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
depends_on("A","B") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
=========================== | ||
step 1 | ||
lua ProjectDIR/src/lmod.in.lua bash --regression_testing --version | ||
=========================== | ||
=========================== | ||
step 2 | ||
lua ProjectDIR/src/lmod.in.lua bash --regression_testing load A C | ||
=========================== | ||
LOADEDMODULES="A:B:C"; | ||
export LOADEDMODULES; | ||
MODULEPATH="ProjectDIR/rt/depends_on/mf/Core"; | ||
export MODULEPATH; | ||
_LMFILES_="ProjectDIR/rt/depends_on/mf/Core/A.lua:ProjectDIR/rt/depends_on/mf/Core/B.lua:ProjectDIR/rt/depends_on/mf/Core/C.lua"; | ||
export _LMFILES_; | ||
_ModuleTable_='_ModuleTable_={["MTversion"]=3,depthT={},family={},mT={A={["fn"]="ProjectDIR/rt/depends_on/mf/Core/A.lua",["fullName"]="A",["loadOrder"]=1,propT={},["stackDepth"]=0,["status"]="active",["userName"]="A",},B={["fn"]="ProjectDIR/rt/depends_on/mf/Core/B.lua",["fullName"]="B",["loadOrder"]=2,propT={},["stackDepth"]=1,["status"]="active",["userName"]="B",},C={["fn"]="ProjectDIR/rt/depends_on/mf/Core/C.lua",["fullName"]="C",["loadOrder"]=3,propT={},["stackDepth"]=0,["status"]="active",["userName"]="C",},},mpathA={"ProjectDIR/rt/depends_on/mf/Core",},["systemBaseMPATH"]="ProjectDIR/rt/depends_on/mf/Core",}'; | ||
export _ModuleTable_; | ||
=========================== | ||
step 3 | ||
lua ProjectDIR/src/lmod.in.lua bash --regression_testing list | ||
=========================== | ||
MODULEPATH="ProjectDIR/rt/depends_on/mf/Core"; | ||
export MODULEPATH; | ||
_ModuleTable_='_ModuleTable_={["MTversion"]=3,depthT={},family={},mT={A={["fn"]="ProjectDIR/rt/depends_on/mf/Core/A.lua",["fullName"]="A",["loadOrder"]=1,propT={},["stackDepth"]=0,["status"]="active",["userName"]="A",},B={["fn"]="ProjectDIR/rt/depends_on/mf/Core/B.lua",["fullName"]="B",["loadOrder"]=2,propT={},["stackDepth"]=1,["status"]="active",["userName"]="B",},C={["fn"]="ProjectDIR/rt/depends_on/mf/Core/C.lua",["fullName"]="C",["loadOrder"]=3,propT={},["stackDepth"]=0,["status"]="active",["userName"]="C",},},mpathA={"ProjectDIR/rt/depends_on/mf/Core",},["systemBaseMPATH"]="ProjectDIR/rt/depends_on/mf/Core",}'; | ||
export _ModuleTable_; | ||
=========================== | ||
step 4 | ||
lua ProjectDIR/src/lmod.in.lua bash --regression_testing unload C | ||
=========================== | ||
LOADEDMODULES="A"; | ||
export LOADEDMODULES; | ||
MODULEPATH="ProjectDIR/rt/depends_on/mf/Core"; | ||
export MODULEPATH; | ||
_LMFILES_="ProjectDIR/rt/depends_on/mf/Core/A.lua"; | ||
export _LMFILES_; | ||
_ModuleTable_='_ModuleTable_={["MTversion"]=3,depthT={},family={},mT={A={["fn"]="ProjectDIR/rt/depends_on/mf/Core/A.lua",["fullName"]="A",["loadOrder"]=1,propT={},["stackDepth"]=0,["status"]="active",["userName"]="A",},},mpathA={"ProjectDIR/rt/depends_on/mf/Core",},["systemBaseMPATH"]="ProjectDIR/rt/depends_on/mf/Core",}'; | ||
export _ModuleTable_; | ||
=========================== | ||
step 5 | ||
lua ProjectDIR/src/lmod.in.lua bash --regression_testing list | ||
=========================== | ||
MODULEPATH="ProjectDIR/rt/depends_on/mf/Core"; | ||
export MODULEPATH; | ||
_ModuleTable_='_ModuleTable_={["MTversion"]=3,depthT={},family={},mT={A={["fn"]="ProjectDIR/rt/depends_on/mf/Core/A.lua",["fullName"]="A",["loadOrder"]=1,propT={},["stackDepth"]=0,["status"]="active",["userName"]="A",},},mpathA={"ProjectDIR/rt/depends_on/mf/Core",},["systemBaseMPATH"]="ProjectDIR/rt/depends_on/mf/Core",}'; | ||
export _ModuleTable_; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters