Thread: [Lmod-users] Sorting of grouped avail
A Lua based environment module system that reads TCL modulefiles.
Brought to you by:
rtmclay
|
From: Marcus W. <wa...@it...> - 2025-04-24 05:37:59
Attachments:
smime.p7s
|
Hello all, we are using a hierarchical module naming scheme. For us, it looks like the sorting of the groups depends on the order in the modulepath. Is there a possibility, to influence the sorting? how it looks now: global aliases MPI modules Compiler modules Core modules personal Core modules what we would like to achieve: global aliases Core modules personal Core modules Compiler modules MPI modules Does anyone have a hint? Best Marcus -- Dipl.-Inf. Marcus Wagner stellv. Gruppenleitung IT Center Gruppe: Server, Storage, HPC Abteilung: Systeme und Betrieb RWTH Aachen University Seffenter Weg 23 52074 Aachen Tel: +49 241 80 24383 wa...@it... www.itc.rwth-aachen.de Social-Media-Kanäle des IT Centers: https://blog.rwth-aachen.de/itc/ https://www.facebook.com/itcenterrwth https://www.instagram.com/itcenterrwthaachen/ https://www.linkedin.com/company/itcenterrwth https://www.youtube.com/c/ITCenterRWTHAachen |
|
From: Robert M. <mc...@ta...> - 2025-05-02 23:23:59
|
As you have pointed out, you can change the order of avail output by ordering the directories in MODULEPATH. However changing the order of the directories in MODULEPATH also affects which modules are loaded when there are duplicates. By using append_path instead of prepend_path will change the order but it is probably not what want. Lmod does provide a hook called "msgHook" which gives you the name "avail", "spider" or "list". You could write your own hook to intercept the output of avail and re-order the output in whatever order you like. Best, Lmod Team |
|
From: Marcus W. <wa...@it...> - 2025-05-05 08:36:12
Attachments:
smime.p7s
|
Hi Lmod Team,
thanks, i wasn't aware of the msgHook. For anyone being interested, here
is my code:
--- hook for sorting module avail
local function msg_hook(kind, a)
if (kind == "avail") then
local mtype = "ga"
local b = {}
local sort = { "ga", "core", "pcore", "comp", "pcomp", "mpi",
"pmpi", "cont", "rest" }
for _,k in ipairs (sort) do
b[k] = {}
end
--- put parts into new tables
for k in pairs (a) do
if a[k]:sub(1,4) == "----" then
if a[k]:find("Your personal Core modules", 1, true ) ~= nil
then
mtype = "pcore"
elseif a[k]:find("Your personal Compiler dependent
modules", 1, true ) ~= nil then
mtype = "pcomp"
elseif a[k]:find("Your personal MPI dependent modules", 1,
true ) ~= nil then
mtype = "pmpi"
elseif a[k]:find("Core Modules", 1, true ) ~= nil then
mtype = "core"
elseif a[k]:find("Compiler dependent Modules", 1, true ) ~=
nil then
mtype = "comp"
elseif a[k]:find("MPI dependent Modules", 1, true ) ~= nil then
mtype = "mpi"
elseif a[k]:find("Container Image Modules", 1, true ) ~=
nil then
mtype = "cont"
end
elseif a[k]:find(" Where:", 1, true) ~= nil then
mtype = "rest"
end
b[mtype][#b[mtype]+1] = a[k]
end
--- delete avail table
for k in pairs (a) do
a[k] = nil
end
--- fill table again with our sort order
for _,k in ipairs (sort) do
for v in pairs (b[k]) do
a[#a+1] = b[k][v]
end
end
end
end
hook.register("msgHook", msg_hook)
Best
Marcus
Am 03.05.2025 um 01:23 schrieb Robert McLay:
> As you have pointed out, you can change the order of avail output by
> ordering the directories in MODULEPATH. However changing the order of
> the directories in MODULEPATH also affects which modules are loaded
> when there are duplicates. By using append_path instead of
> prepend_path will change the order but it is probably not what want.
>
> Lmod does provide a hook called "msgHook" which gives you the name
> "avail", "spider" or "list". You could write your own hook to
> intercept the output of avail and re-order the output in whatever
> order you like.
>
> Best,
> Lmod Team
>
>
>
>
--
Dipl.-Inf. Marcus Wagner
stellv. Gruppenleitung
IT Center
Gruppe: Server, Storage, HPC
Abteilung: Systeme und Betrieb
RWTH Aachen University
Seffenter Weg 23
52074 Aachen
Tel: +49 241 80 24383
wa...@it...
www.itc.rwth-aachen.de
Social-Media-Kanäle des IT Centers:
https://blog.rwth-aachen.de/itc/
https://www.facebook.com/itcenterrwth
https://www.instagram.com/itcenterrwthaachen/
https://www.linkedin.com/company/itcenterrwth
https://www.youtube.com/c/ITCenterRWTHAachen
|
|
From: Marcus W. <wa...@it...> - 2025-05-05 12:53:25
Attachments:
smime.p7s
|
Dear Lmod Team, sorry for the double post, just saw that I did not answer to the list. I also wanted to add something, thus: It seems, that ml ov does not use the msgHook Is that intended? btw.: $> module --version Modules based on Lua: Version 8.7.47 2024-07-22 10:04 -04:00 by Robert McLay mc...@ta... It seems, that if the msgHook is registered, module spider does not work anymore. Is that a known bug? $> ml spider /usr/bin/lua: /opt/lmod/8.7.47/libexec/cmdfuncs.lua:1068: bad argument #1 to 'concatTbl' (table expected, got nil) stack traceback: [C]: in function 'table.concat' /opt/lmod/8.7.47/libexec/cmdfuncs.lua:1068: in function 'SpiderCmd' /opt/lmod/8.7.47/libexec/lmod:517: in function 'main' /opt/lmod/8.7.47/libexec/lmod:588: in main chunk [C]: in ? it suffices to create an empty function an register that for the msgHook Best Marcus Am 03.05.2025 um 01:23 schrieb Robert McLay: > As you have pointed out, you can change the order of avail output by > ordering the directories in MODULEPATH. However changing the order of > the directories in MODULEPATH also affects which modules are loaded > when there are duplicates. By using append_path instead of > prepend_path will change the order but it is probably not what want. > > Lmod does provide a hook called "msgHook" which gives you the name > "avail", "spider" or "list". You could write your own hook to > intercept the output of avail and re-order the output in whatever > order you like. > > Best, > Lmod Team > > > > -- Dipl.-Inf. Marcus Wagner stellv. Gruppenleitung IT Center Gruppe: Server, Storage, HPC Abteilung: Systeme und Betrieb RWTH Aachen University Seffenter Weg 23 52074 Aachen Tel: +49 241 80 24383 wa...@it... www.itc.rwth-aachen.de Social-Media-Kanäle des IT Centers: https://blog.rwth-aachen.de/itc/ https://www.facebook.com/itcenterrwth https://www.instagram.com/itcenterrwthaachen/ https://www.linkedin.com/company/itcenterrwth https://www.youtube.com/c/ITCenterRWTHAachen |
|
From: Marcus W. <wa...@it...> - 2025-05-12 12:11:12
Attachments:
smime.p7s
|
Once again, we have two issues with the msgHook. We are using Lmod 8.7.47. first: As soon as an even empty function doing nothing is registered as a msgHook, module spider does not work anymore: $> ml spider /usr/bin/lua: /opt/lmod/8.7.47/libexec/cmdfuncs.lua:1068: bad argument #1 to 'concatTbl' (table expected, got nil) stack traceback: [C]: in function 'table.concat' /opt/lmod/8.7.47/libexec/cmdfuncs.lua:1068: in function 'SpiderCmd' /opt/lmod/8.7.47/libexec/lmod:517: in function 'main' /opt/lmod/8.7.47/libexec/lmod:588: in main chunk [C]: in ? is that a known bug? second: the msgHook seems to not influence the output of module overview Is that intended or just missing? Best Marcus Am 05.05.2025 um 14:52 schrieb Marcus Wagner: > > Dear Lmod Team, > > > sorry for the double post, just saw that I did not answer to the list. > I also wanted to add something, thus: > > It seems, that > > ml ov > > does not use the msgHook > > > Is that intended? > > > btw.: > > $> module --version > > Modules based on Lua: Version 8.7.47 2024-07-22 10:04 -04:00 > by Robert McLay mc...@ta... > > It seems, that if the msgHook is registered, module spider does not > work anymore. Is that a known bug? > > > $> ml spider > /usr/bin/lua: /opt/lmod/8.7.47/libexec/cmdfuncs.lua:1068: bad argument > #1 to 'concatTbl' (table expected, got nil) > stack traceback: > [C]: in function 'table.concat' > /opt/lmod/8.7.47/libexec/cmdfuncs.lua:1068: in function > 'SpiderCmd' > /opt/lmod/8.7.47/libexec/lmod:517: in function 'main' > /opt/lmod/8.7.47/libexec/lmod:588: in main chunk > [C]: in ? > > > it suffices to create an empty function an register that for the msgHook > > > Best > Marcus > > > Am 03.05.2025 um 01:23 schrieb Robert McLay: >> As you have pointed out, you can change the order of avail output by >> ordering the directories in MODULEPATH. However changing the order >> of the directories in MODULEPATH also affects which modules are >> loaded when there are duplicates. By using append_path instead of >> prepend_path will change the order but it is probably not what want. >> >> Lmod does provide a hook called "msgHook" which gives you the name >> "avail", "spider" or "list". You could write your own hook to >> intercept the output of avail and re-order the output in whatever >> order you like. >> >> Best, >> Lmod Team >> >> >> >> > -- > Dipl.-Inf. Marcus Wagner > stellv. Gruppenleitung > > IT Center > Gruppe: Server, Storage, HPC > Abteilung: Systeme und Betrieb > RWTH Aachen University > Seffenter Weg 23 > 52074 Aachen > Tel: +49 241 80 24383 > wa...@it... > www.itc.rwth-aachen.de > > Social-Media-Kanäle des IT Centers: > https://blog.rwth-aachen.de/itc/ > https://www.facebook.com/itcenterrwth > https://www.instagram.com/itcenterrwthaachen/ > https://www.linkedin.com/company/itcenterrwth > https://www.youtube.com/c/ITCenterRWTHAachen -- Dipl.-Inf. Marcus Wagner stellv. Gruppenleitung IT Center Gruppe: Server, Storage, HPC Abteilung: Systeme und Betrieb RWTH Aachen University Seffenter Weg 23 52074 Aachen Tel: +49 241 80 24383 wa...@it... www.itc.rwth-aachen.de Social-Media-Kanäle des IT Centers: https://blog.rwth-aachen.de/itc/ https://www.facebook.com/itcenterrwth https://www.instagram.com/itcenterrwthaachen/ https://www.linkedin.com/company/itcenterrwth https://www.youtube.com/c/ITCenterRWTHAachen |
|
From: Robert M. <mc...@ta...> - 2025-05-12 23:23:43
|
I have moved the discussion of this issue to Lmod's github site: https://github.com/TACC/Lmod/issues/763 [https://opengraph.githubassets.com/1d4f095a8eefc8602bb563d4dc6ac00dadaaad72cea89d425b1472a304e7a94d/TACC/Lmod/issues/763]<https://github.com/TACC/Lmod/issues/763> Empty msgHook fails with spider and msgHook is not active for overview · Issue #763 · TACC/Lmod<https://github.com/TACC/Lmod/issues/763> A user reported these bugs on the Lmod mailing list. I have moved it here for tracking. github.com I was able to reproduce your issue and fix it for me. Please see the discussion described above. Best, Robert |