Ruby Statements Stopped Working After Upgrading to 4.0

Greetings,
After upgrading to OnDemand 4.0, the .erb job submission scripts stopped processing the statements inside the ruby evaluation tags (<%- -%>). Those were working as intended with OnDemand 3.X. Here is a sample submit.yml.erb script:


batch_connect:

template: “basic”

set_host: “host=$(hostname -A | awk ‘{print $2}’)”
min_port: 8000
max_port: 8999
script:

native:
- “–constraint=jupyter”
- “–mem”
- “<%= memory %>G”
- “–cpus-per-task”
- “<%= cpus %>”
<%- if gpuType == “First” -%>
- “–gres=gpu:<%= gpus %>”
<%- end -%>
<%- if gpuType == “A100” || gpuType == “V100” || gpuType == “L40S” || gpuType == “TITAN_V” -%>
- “–gres=gpu:<%= gpuType %>:<%= gpus %>”
<%- end -%>
- “–time”
- “<%= custom_num_hours %>:00:00”
- “–nodes=1”
- “–mail-type=ALL”
- “–mail-user”
- “<%= slurm_email_address %>”
<%- if num_cores.to_i > 8 || custom_num_hours.to_i > 2 -%>
- “–partition=long”
<%- else -%>
- “–partition=<%= custom_queue %>”
<%- end -%>

Note that variable values like cpu and custom_queue were still being evaluated correctly

So you’re saying gpuType doesn’t work as expected? If so, what was the name of the form entry you used? I want to say we had to cast everything to lowercase so a camelCase thing like this won’t work in 4.0. Honestly I’m a bit surprised that camelCase has ever worked.

changing the variable from gpuType to gpu_type fixed it. Awesome, thank you.

1 Like