Hi, we have finally gotten to the point that we have a common header script to be included in all forms for all applications.
<%-
#Get list of groups user belongs to
g_cmd = "/usr/local/sbin/user-groups.sh $USER"
begin
output, status = Open3.capture2e(g_cmd)
if status.success?
accounts = output.split("\n").map(&:strip).reject(&:blank?).sort
priaccts = accounts.grep(/priority/)
grpaccts = accounts.grep(/group/)
else
raise output
end
rescue => e
queues = []
error = e.message.strip
end
-%>
We now also have common attributes for a smart form that allows only certain groups to be selected when choosing a certain partition to send a job to, and sets constraints for the amount of memory and cores based on partition selected as well. The common attributes use arrays produced by the header script. It also hides fields based on selections that aren’t relevant.
Here is our base common.yml.erb file:
# # ~/ondemand/dev/jupyter/common.yml.erb
# Get the number of CPU's
num_cores:
widget: "number_field"
label: "Number of CPU's"
help: "<small>Number of CPU's for Jupyter session.</small>"
value: 4
min: 2
max: 256
step: 1
# Get the number of GPU's
num_gpus:
label: "Number of GPU's"
widget: "number_field"
help: "<small>Number of GPU's to allocate for job</small>"
min: 0
max: 4
value: 0
step: 1
# Get the number of Memory in GB
mem_task:
widget: "number_field"
label: "Size of RAM in GB"
help: "<small>The amount of memory to allocate for job</small>"
value: 4
min: 4
max: 1000
step: 1
# Get the accounts
custom_paccount:
label: "Priority Accounts"
help: "<small>Select priority account to submit job under</small>"
widget: select
options:
<%- priaccts.each do |a| -%>
- [ "<%= a %>", "<%= a %>" ]
<%- end -%>
custom_gaccount:
label: "Group Accounts"
help: "<small>Select group account to submit job under</small>"
widget: select
options:
<%- grpaccts.each do |a| -%>
- [ "<%= a %>", "<%= a %>" ]
<%- end -%>
# Get the GPU type
# A40 nodes have up to 64 CPUs and 500G
# A100 nodes have up to 96 CPUs and 500G
gpu_type:
label: "NVidia GPU Type"
help: "<small>VRAM A40 > A100, Compute A100 > A40</small>"
widget: select
options:
- [
'NVidia A40', 'a40',
data-max-num-gpus: 2,
data-max-num-cores : 64,
data-max-mem-task : 500,
]
- [
'NVidia A100', 'a100',
data-max-num-gpus: 4,
data-max-num-cores : 96,
data-max-mem-task : 500,
]
enable_pri_queue:
widget: "check_box"
custom_queue:
label: "Partition"
help: "<small>Select the partition to allocate Jupyter job to.</small>"
widget: select
options:
- [
'Priority', 'priority',
I’m wondering how accessing arrays generated by the header script from the attributes that are read in. Can somebody please point me in the right direction? I’ll keep digging through the forums for examples.
Kenny