We’re Ruby novices so hoping for a bit of help from the community. We have a Jupyter notebook job that we would like to make a bit more friendly for users. We have 4 node types: compute, gpu, quickq, and bigmem. We currently have a GPU option that shows up as an option for all node types, even though there are only GPUs in the GPU queue, options: none, one, or two GPUs. This causes issues at times with people inadvertently selecting a GPU when selecting a compute node, then the job not able to start due to incompatible node configuration. We want to add some sort of conditional statement where if someone selects a GPU node, only then do the GPU selection options show up. This is our current submit.yml.erb:
batch_connect:
template: "basic"
set_host: "host=$(hostname -A | awk -F . '{print $1}')"
script:
queue_name: <%= custom_queue %>
native:
- "-N 1"
- "--ntasks"
- "<%= num_cores.blank? ? 1 : num_cores.to_i %>"
- "--job-name=JupyterLab_OOD"
- "--mail-user"
- "<%= mail_user %>"
- "--mail-type=ALL"
- "--job-name=Jupyter_Lab"
<% if custom_queue == "gpu" %>
- "--gres=gpu:<%= gpu_type %>"
<% end %>
<% if not sh_mem.blank? %>
- "--mem"
- "<%= sh_mem.to_i %>G"
<% end %>
And the corresponding custom_queue field in form.yml:
custom_queue:
label: Node Type
help: Please select a node type from the drop-down.
widget: select
options:
- [ "Compute", "compute" ]
- [ "Big Memory", "bigmem" ]
- [ "GPU", "gpu" ]
- [ "Quickq", "quickq"]
I know we’re probably missing something entirely obvious, but this logic in submit.yml.erb doesn’t seem to work, and the GPU selection options still show up no matter what node type is selected. Would appreciate any help to update this to achieve what we are looking for.