Cluster specific modules don't populate in form.yml.erb

Hello,

I’m creating a form for users to submit job to the cluster. One of the field is version and I want to auto populate it with the every single version available of that software installed on cluster. I’m using auto_modules attributes. and using these docs:

https://osc.github.io/ood-documentation/latest/how-tos/app-development/interactive/form.html#automatic-predefined-attributes

and

https://osc.github.io/ood-documentation/latest/reference/files/ondemand-d-ymls.html#module-file-dir

I created json file:

/usr/share/lmod/lmod/libexec/spider -o spider-json $MODULEPATH > /etc/reporting/modules/viking.json

And referenced it in cluster config file:
grep module_file /etc/ood/config/clusters.d/viking.yml

module_file_dir: “/etc/reporting/modules”

My form.yml.erb looks like this:

Version:
widget: ‘select’
attributes:
auto_modules_ansys:
default: true

However it doesn’t populate in the browser. I see empty drop down menu.

I don’t see

form:
  - auto_modules_ansys

In your form.yml file - when I copy your form.yml file, not even a select box shows up (I’m not sure if I’m getting the indentation right). But if I add the above bit of code, the version list shows up and populates.

I see that the docs aren’t clear that this is a required line - I’ll get this updated this morning.

This is my full form.html.erb code:


cluster: “viking”

form:

  • Solver
  • Version
  • License
  • Nodes
  • bc_queue
  • bc_num_slots
  • bc_num_hours
  • bc_email_on_started
  • Select File

Solver:
widget: ‘select’
options:
- [“Ansys”]
- [“CFX”]
- [“Fluent”]
- [“Star-CCM+”]
Version:
widget: ‘select’
attributes:
auto_modules_ansys:
default: true
Select File:
widget: “path_selector”
directory: “/fs/cluster/data”
show_hidden: true

And It’s what I see when I look at the web page. The select box is there but it’s empty:

So I’ll show this as an example of how the main components form and attributes work. form is a list of form choices for the application. attributes is then specifying what those items in form are, whether they’re number fields or choices and so on. auto_modules_* is a form choice that replaces the old `Version’ widget.

Replace

form:
  ...
  - Version
  ...

with

form:
 ...
  - auto_modules_ansys
 ...

You should also remove:

Version:
  widget: 'select'
  attributes:
    auto_modules_ansys:
      default: true

If you were going to change default to false, you would add the auto_modules_ansys attribute to the attributes list like this:

attributes:
  auto_modules_ansys:
    default: false

However, the default version is included in the version list by default, so there’s no need to explicitly specify default: true.

Thank you for the answer. It does look a little better now. I see the default in drop down menu but no other versions.

An another question I will need different modules there depending on Solver field choice. Is it possible on this level to make it dynamically populated?

Another thing to note about the auto_modules_* attribute is that it’s case-sensitive. On my system, when I use auto_modules_ansys, I get a list of versions, but if I use auto_modules_Ansys, I only have a select box with the ‘default’ selectable. So it’s possible that by changing your form to auto_modules_Ansys with a capital A, it’ll pick up all of the versions. It depends on what the module is named in your system.

For the other question, it’s not possible to make this field dynamic at this level. The cluster-awareness is built into the dashboard code base, and adding the ability to generate the list dynamically based off of a regex is on the roadmap, but currently even that functionality does not exist.

Yeah, I have read in the docs that it’s case sensitive but in my case everything is low case:

module avail ansys
---------------------------- /cluster/apps/modules/fea ----------------------------
ansys/11.0 ansys/14.5 ansys/16.1 ansys/18.0 ansys/19.3 ansys/22.2
ansys/12.0 ansys/14.5.7 ansys/16.2 ansys/18.1 ansys/20.1 ansys/default
ansys/12.1 ansys/15.0 ansys/17.0 ansys/18.2 ansys/21.1
ansys/13.0 ansys/15.0.7 ansys/17.1 ansys/19.0 ansys/21.2
ansys/14.0 ansys/16.0 ansys/17.2 ansys/19.2 ansys/22.1

and it’s still not working.

For the dynamic populated question:

So if I try to to hide ansys module filed based on my chose it’s expected not to work?

attributes:
Solver:
widget: ‘select’
options:
- [“Ansys”]
- [
“CFX”,
data-hide-auto-modules-ansys: true

I added

module_file_dir: “/etc/reporting/modules”
bc_dynamic_js: true

at the end of my /etc/ood/config/clusters.d/viking.yml

Is it where it suppose to go? Do you have an example by any chance. My dynamic choice by cluster is not working as well (all queus are showing regardless of cluster chosen) and I think this might be a reason, that I put these 2 directives in a wrong place.

Asking as a sanity check - have you restarted your web-server since changing these configs? Beyond that, could you share the viking.json file so I can attempt to replicate your issue?

data-hide-auto-modules-ansys: true will hide the entire field generated by auto_modules_ansys when ‘CFX’ is selected, not change the list of versions it shows, which is how I interpreted your ask.

Yes, I restarted web server.

data-hide-auto-modules-ansys: true will hide the entire field generated by auto_modules_ansys when ‘CFX’ is selected, not change the list of versions it shows, which is how I interpreted your ask.

And yes it’s what exactly I want. But it’s not working together with modules populating and queues populating depending on cluster choice ( all of them are there, but they are not dynamically populated).

I attached my json and cluster yml files

And my form.yml.erb just in case

viking.json (618.9 KB)
viking.yml (1.3 KB)
form.yml (1.0 KB)

After adding these 2 lines:

OOD_BC_DYNAMIC_JS=TRUE
OOD_MODULE_FILE_DIR: /etc/reporting/modules

in /etc/ood/config/apps/dashboard/env

everything started working.

Thank you for helping out.

Only 1 hiccup I see if modules have some nested path is not working.

For example for CFX not working

module avail cfx
---------------------------- /cluster/apps/modules/cfd ----------------------------
cfx/double/11.0 cfx/single/11.0 cfx/zzz_default
cfx/double/12.0 cfx/single/12.0
cfx/double/12.1 cfx/single/12.1
cfx/double/13.0 cfx/single/13.0
cfx/double/14.0 cfx/single/14.0

VS ansys which is working.

module avail ansys
---------------------------- /cluster/apps/modules/fea ----------------------------
ansys/11.0 ansys/14.5 ansys/16.1 ansys/18.0 ansys/19.3 ansys/22.2
ansys/12.0 ansys/14.5.7 ansys/16.2 ansys/18.1 ansys/20.1 ansys/default
ansys/12.1 ansys/15.0 ansys/17.0 ansys/18.2 ansys/21.1
ansys/13.0 ansys/15.0.7 ansys/17.1 ansys/19.0 ansys/21.2
ansys/14.0 ansys/16.0 ansys/17.2 ansys/19.2 ansys/22.1

Is it expected?

Yes, we don’t currently support nested modules. @jeff.ohrstrom has created an issue for this on GitHub: support nested modules in auto_modules · Issue #3378 · OSC/ondemand · GitHub

Copy. Thank you for opening issue. Last one thing to clarify. When we add new modules we need to rerun spider json command, correct?

Correct, and beyond that, you could create a crontab entry to populate the file at regular intervals.

Thanks, it’s what I though to do.

In my attempt to work around nested modules I created CFX directory and copied my modules there. I updated my json with modules and I my form and I can see modules now. But I can hide this field for some reason:

form:

  • Solver
  • auto_modules_ansys
  • auto_modules_CFX

attributes:
Solver:
widget: ‘select’
options:
- [“Ansys”,
data-hide-auto-modules-CFX: true,
data-hide-auto-modules-fluent: true,
data-hide-auto-modules-starccm: true
]

It doesn’t hide CFX, but hides fluent and starccm.

Is anything wrong with my code?

I’ve tested your code, and found that I can reproduce your issue whenever I use any attribute name with a capital letter in a data-hide directive, so I’ve opened an issue for it on GitHub (data-hide not picking up on names with capital letters · Issue #3381 · OSC/ondemand · GitHub) and am currently investigating.

Thank you for letting me know. I actually want to report that there is a workaround nested modules.

If I copy one module to the root directory cfx/22.1 and then run spder command to update my json my from can see all nested modules.

Suddenly my path_selector stopped working.

It was working fine and I’m not even sure when it stopped. It looks like it cannot open my home directory.

path:
widget: “path_selector”
directory: “/fs/home”
show_hidden: true

When I click Select path I don’t see any files and I cannot choose anything:

Screenshot from 2024-02-27 15-40-55

But I can open all right my home directory under files in Ondemand dashboard application:

Screenshot from 2024-02-27 15-47-10

Is there any logs I can check why it stopped working?

This looks like an issue we’ve seen before and have been unable to reproduce consistently (path_selector - buggy behavior when selecting for the second time. · Issue #3060 · OSC/ondemand · GitHub and selecting a path a second time seems broken · Issue #2711 · OSC/ondemand · GitHub). Because I know that I don’t know how to reproduce it, I can’t test myself if clearing the browser cache is a temporary way around this, but based on what I know of the code, it should work. If it doesn’t, definitely let me know and I’ll investigate further for a work-around.

Here is a new ticket for it: path_selector inconsistently broken · Issue #3385 · OSC/ondemand · GitHub

I cleaned my browse cache and I tried incognito mode and it didn’t help.

My OnDemand version: 3.0.3. Is it better in a new version or do you see it in all versions?

And I can replicate this issue as well.

I have an older version of Ondemand 2.0.32 and I see path selector error there:

#<ActionView::Template::Error: undefined method `path_selector’ for #BootstrapForm::FormBuilder:0x00007f2d18de7c58>

Was path selector only intorduced recently?