kstine
(Kurt Stine)
July 23, 2025, 6:39pm
1
A sort of follow-up to this:
Is it possible to have OOD only show and use form.yml options if a checkbox is unclicked?
I’d like to make it so that if a user checks a “use entire node” button, it’ll send --exclusive to the submit.yml (and the script.sh.erb). But if it’s unchecked, it would show memory, cpus, and gpus to be requested (and send those values to the script.sh.erb).
Is this possible? Or would I need to set up two apps, one for --exclusive and one without?
I have a check box hiding elements currently implemented in my form.yml:
m_exclusive:
widget: "check_box"
label: "Use entire node"
html_options:
data:
hide-m-cpus-when-checked: true
hide-m-mem-when-checked: true
hide-m-gpus-when-checked: true
data-set-m-cpus: "--exclusive"
data-set-m-mem: ""
data-set-m-gpus: ""
My submit.yml looks like the following:
native:
- "-J"
- "<%= m_name %>"
- "-N"
- "1"
- "--mem"
- "<%= m_mem %>G"
- "-c"
- "<%= m_cpus %>"
- "-G"
- "<%= m_gpus %>"
How do I make it so that if a user selects the m_exclusive
checkbox that it will only send --exclusive
?
I don’t think checkboxes have support for data-set
directives yet.
I think you need to handle this in the submit.yml.erb
. Something like this should do.
<%-
args = ["-J", m_name, "-N", "1", "--mem", "#{m_mem}G", "-c", m_cpus, "-G", m_gpus]
args.concat(["--exclusive"]) if m_exclusive == 1
-%>
script:
native:
<%- args.each do |arg| %>
- "<%= arg %>"
<%- end %>
Though note that I don’t exactly recall how checkboxes are passed - i.e., as 1 and 0 or true and false and so on. I’m pulling that from memory without checking how it actually works.
kstine
(Kurt Stine)
July 24, 2025, 4:00pm
3
There’s something odd going on with the --mem
portion as after adding the the args script, sbatch keeps giving the following in OOD:
sbatch: error: Invalid --mem specification
The job_script_options.json
file from the refused job shows the following when the m_exclusive
checkbox is checked:
"native": [
"-J",
"worker",
"-N",
"1",
"--mem",
"G",
"-c",
"",
"-G",
""
It looks like it’s still passing through the hidden options?
yes it seems like you need extra logic there if m_exclusive == 1
kstine
(Kurt Stine)
July 24, 2025, 6:04pm
5
I wrote out the following:
script:
native:
- "-J"
- "<%= m_name %>"
- "-N"
- "1"
<%- if m_exclusive == true %>
- "--exclusive"
<%- else %>
- "--mem"
- "<%= m_mem %>G"
- "-G"
- <%= m_gpus %>
- "-c"
- <%= m_cpus %>
<%- end %>
Used your script as inspiration and it seems to be working fine!
EDIT : I swapped it for the following and it seems to work better, although still not very cleanly:
script:
native:
- "-J"
- "<%= m_name %>"
- "-N"
- "1"
<%- if m_exclusive = 1 %>
- "--exclusive"
<%- end %>
<%- if m_exclusive = 0 %>
- "--mem"
- "<%= m_mem %>G"
- "-G"
- <%= m_gpus %>
- "-c"
- <%= m_cpus %>
<%- end %>
kstine
(Kurt Stine)
July 28, 2025, 6:42pm
6
@jeff.ohrstrom Turns out the above doesn’t actually work. If you previously clicked the m_exclusive
button, it still keeps the --exclusive
in the job script options.
Example:
"native": [
"-J",
"worker",
"-N",
"1",
"--exclusive",
"--mem",
"160G",
"-G",
1,
"-c",
32
]
It should be removing the --exclusive
if unchecked, right?
kstine:
if m_exclusive = 0
One single =
is the assignment operator. You’re assigning m_exclusive to 0 then evaluating that result as a boolean.
You need the equality operator ==
.
1 Like