auto_modules_<MODULE> json help

I am trying to set up an app to make use of the new auto_modules feature in the form. In this case I am looking for Ansys modules.

The selection widget appears on the form, but it is empty and just has “default” as an option.

I see in the documentation that it is looking to parse a json file in the provided config setting… module_file_dir: “/opt/Software/corvid/.modules” (which is my dir)

I do not have the module spider command available on my machine, so auto-generating the json file is not possible. So I am attempting to create it manually.

Example:

[
    {
        "defaultVersionName": "v232",
        "description": "ansys modules",
        "package": "ansys",
        "versions": [
            {
                "canonicalVersionString": "000000001.*zfinal",
                "full": "ansys/v232",
                "help": "Ansys 2023 r2",
                "markedDefault": true,
                "path": "ansys/v232",
                "versionName": "v232",
            },
        ]
    }
]

What am I missing here? Is there a way I can get this feature to hook by manually creating a json file in my modules dir?

It is possible to construct the json, but it is gong to be very hard. Is there something preventing the use of lmod to produce the json for you?

It would be much easier to rely on the library that does this rather than try to implement it yourself by building the json by hand. So in theory yes, but I would ask why not simplify things and use lmod?

Apparently we have not implemented lua modules into our setup (runs slow per IT), and we are using environment modules not LMOD. So I can check module avail, however module spider does not exist as a command.

I suppose I was looking to see what OOD looks for in the json file specifically, so that I could have it populate the dropdown with existing modules without updating the app every time.

Sure. The code that’s trying to do this is in Ruby so it may be tricky, but here’s what OOD is doing to make this happen:

And that json file can be pretty huge and have tons and tons of options for various apps. But ultimately it needs the name of the app, and then it just wants the versions that comes with that name.

I’ve captured a screenshot of some JSON from the file on a cluster to give you an idea what this should look like:

1 Like

I couldn’t figure it out, but you provided me the inspiration to just write a basic ruby loop in the modules dir. Not sure why I didn’t think of it before. Thanks!

  version:
    widget: select
    label: "ANSYS Release version"
    options:
<% 
modules=Dir["/opt/Software/corvid/.modules/ansys/*"]
modules.each do |x| 
%>
    - [ "<%=File.basename(x)%>" ]
<%
end
%>    

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.