Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module-info mode returns "load" when running module spider #739

Open
paran1 opened this issue Dec 12, 2024 · 3 comments
Open

module-info mode returns "load" when running module spider #739

paran1 opened this issue Dec 12, 2024 · 3 comments

Comments

@paran1
Copy link

paran1 commented Dec 12, 2024

Describe the bug
When running module spider or module avail the tcl function module-info mode load is true, and module-info mode return "load". This is not exepected as the module is not being loaded.

I have tested using Lmod 8.7.53 packages from EPEL on Rocky Linux 8 and 9.

Example tcl and lua module:
(Please excuse these horrible module file examples, I am sure there are better ways than exec bash to show this)

# cat /tmp/modules/test/1
#%Module
module-whatis [ exec /bin/bash -c "echo tcl module-info mode: [ module-info mode ], Lmod: $ModuleToolVersion >> /tmp/modules/log" ]
setenv TEST test-tcl

# cat /tmp/modules/test/2.lua 
local foo = capture("/bin/bash -c \"echo lua mode: " .. mode() .. ", Lmod: " .. LmodVersion() .. " >> /tmp/modules/log\"")
setenv("TEST", "test-lua")

Run spider:

# module -t spider
test/
test/1
test/2

Log results:

# cat /tmp/modules/log 
tcl module-info mode: load, Lmod: 8.7.53
lua mode: spider, Lmod: 8.7.53

So for the tcl module module-info mode returns load while the Lua module's mode() returns spider.

Additional context
We are upgrading from el7 to el9. We have been using Lmod packages from EPEL so Lmod gets upgraded from 8.2.7 to 8.7.53. We have code in individual module files to log module loads:

#%Module
source /path/to/functions.tcl
# functions.tcl contains the "logToSyslog" function
logToSyslog

A simplified version of logToSyslog is something like this:

proc logToSyslog { } {
  if { [module-info mode load] } {
    # run /bin/logger using exec
  }
}

This have worked fine with Lmod 8.2.7 and earlier, but with 8.7.53 every single module version is logged as being loaded when running module spider.

After checking the documentation I realize that we should probably replace this with a load hook. But the current behavior still seems wrong.

I have not tested using versions between 8.2 and 8.7 to determine when this changed, only checked the ChangeLogs without finding anything.

@wpoely86
Copy link
Contributor

@rtmclay
Copy link
Member

rtmclay commented Dec 13, 2024

I have found the issue and fixed it for me. Please test Lmod 8.7.54 to see if it works for you.

Note that as @wpoely86 says, the load_hooks are a much nicer solution. They are even better as solution as of 8.7.54. Please read the updated documentation to see if it works for you.

@paran1
Copy link
Author

paran1 commented Dec 13, 2024

Yes, I said it in the initial issue also. I am working on setting up a SitePackage with load hooks right now. Much nicer!

The old logging code was inherited, and have been used for many years. I am not trying to defend that solution, I just mentioned it to explain how I ran into this issue.

I will test the new version next week. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants