Last active
January 4, 2016 01:19
-
-
Save bryan-lunt/8547702 to your computer and use it in GitHub Desktop.
A replacement for the "use.own" module that allows one to separate their private modules by cluster.
The advantage of using this instead of just making a conditional "module use --append $CLUSTER_SPECIFIC_PATH" in your .profile is that you can turn this off and on with "module load privatemodules" and "module unload privatemodules" INSTALLATION:…
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
#%Module1.0##################################################################### | |
## | |
## privatemodules modulefile | |
## | |
## An alternative to use.own that lets you have a per-cluster private module directory, | |
## and automatically loads the appropriate one. | |
## | |
## Expects to be installed in ~/.privatemodules/base/privatemodules | |
## | |
proc ModulesHelp { } { | |
global rkoversion | |
puts stderr "\tThis module file will add \$HOME/.privatemodules/\$SDSC_CLUSTER" | |
puts stderr "\tand \$HOME/.privatemodules/common to the" | |
puts stderr "\tlist of directories that the module command will search" | |
puts stderr "\tfor modules. Place your own module files here." | |
puts stderr "\tThis module, when loaded, will create this directory" | |
puts stderr "\tif necessary." | |
puts stderr "\n\tVersion $rkoversion\n" | |
} | |
module-whatis "adds your own modulefiles directory to MODULEPATH" | |
# for Tcl script use only | |
set rkoversion 3.2.9 | |
#setup a dictionary mapping from cutdown hostname to clustername | |
proc getClusterName { } { | |
dict set clustername "trestles" "trestles" | |
dict set clustername "gordon" "gordon" | |
dict set clustername "gcn" "gordon" | |
catch {exec "hostname"} hostname | |
regsub {(\-|\.).*} $hostname "" hostname | |
return [dict get $clustername $hostname] | |
} | |
eval set [ array get env HOME ] | |
set thecluster [ getClusterName ] | |
set ownmoddir $HOME/.privatemodules/$thecluster | |
module use --append $ownmoddir | |
module use --append $HOME/.privatemodules/common |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment