Help with data-hide

Hi!

I have a question regarding the operation of data-hide. My form.yml is configured as follows:

---
attributes:
  bc_dynamic_js: true
  desktop: "xfce"
  bc_vnc_idle: 0
  bc_vnc_resolution:
    required: true
  node_type: null
  bc_num_slots: 2
  num_cores:
    widget: "number_field"
    label: "Number of cores"
    value: 2
  memory:
    label: "Memory"
    value: "1GB"
  node:
    widget: "select"
    label: "Node"
    options:
      - ["gn01", "gn01"]
      - ["gn02", "gn02"]
      - ["gn03", "gn03"]
      - ["n01", "n01", data-hide-gpu: true, data-set-gpu: 'gpu:0']
    cacheable: false
  gpu:
    label: "GPU"
    value: "gpu:0"
    help: "Format: \"gpu:N\" where N is the number of GPUs requested. Use \"gpu:0\" for none (default)."
    cacheable: false
form:
  - bc_vnc_idle
  - desktop
  - node
  - memory
  - gpu
  - auto_queues
  - bc_num_hours
  - num_cores
  - bc_num_slots
  - bc_vnc_resolution
  - bc_email_on_started

And the submit.yml.erb:

---
batch_connect:
  template: vnc
script:
  native:
    - "-c"
    - "<%= num_cores %>"
    - "-w"
    - "<%= node %>"
    - "--mem"
    - "<%= memory %>"
    - "--gres"
    - "<%= gpu %>"

Where, in case the selected node is n01, the GPU selection option should be hidden. However, even when selecting node n01, the GPU option is still visible.

For context, I am using OOD version 4.0.3.

Could you assist me with tips or suggestions for this situation?

Thanks!
Nícolas

I’m interested into this too. Instead of node I’d have good use for it when no-gpu partition is selected. For now I do it with fixed slots eg. for given amount of CPUs you get one GPU..

This is not a part of the form. It’s a global setting you set in a YML file in the /etc/ood/config/ondemand.d directory.

When I load this file it appears to work as expected.

@jose-d can you share an example form.yml you’re trying to get working?

sure, this is the one we use now: OOD-Jupyterhub-in-UV-python-environment/form.yml.erb at master · jose-d/OOD-Jupyterhub-in-UV-python-environment · GitHub . and EDIT: @jeff.ohrstrom I think the snippet above answered my question, I had no idea about this mechanism. I’ll try that, thanks.

Hi Jose and Jeff!

Thank you for the replies.

@jeff.ohrstrom, I removed the line bc_dynamic_js: true from my form.yml and the data-hide worked successfully, thank you so much!

Note: I had created a file dynamic.yml inside /etc/ood/config/ondemand.d with bc_dynamic_js: true, but adding this line to the form.yml turned out to be the problem.

Thanks!
Nícolas

Glad to hear it all worked out. Just for completeness, here’s the documentation for dynamic form widgets like this.

2 Likes