Jupyter custom variables not working

After creating two new variables in the <sandbox_app>/form.yml named:

job_name
number_cores_per_node

form:

  • modules
  • extra_jupyter_args
  • job_name
  • bc_account
  • bc_queue
  • bc_num_hours
  • bc_num_slots
  • number_of_cores_per_node
  • bc_email_on_started

And added to submit.yml.erb:

script:

queue_name: “queue1”

accounting_id: “account1”

email_on_started: true

native: # … array of command line arguments …
- “–ntasks-per-node=”
- “<% number_of_cores_per_node.blank? ? 1 : number_of_cores_per_node.to_i %>”
- “–job-name=”
- “<% job_name.blank? ? jupyter_notebook : job_name.to_i %>”

I am no longer able to submit the job and get the following error:

Do I have to put all of the sbatch command parameters if I used the native option in the submit.yml.erb file or is it supposed to append to the defaults that OOD generates?

I don’t think you want the = there because we add spaces.

The command would look like this
--ntasks-per-node= 1 instead of --ntasks-per-node=1. Without the = it’s --ntasks-per-node 1 which is valid. I think it’s getting mixed up trying to interpret your tokens.

So you’ll need to either stop using = or put the right-side of the = all in one line like:

  - "--ntasks-per-node=<%= number_of_cores_per_node.blank? ? 1 : number_of_cores_per_node.to_i %>"
  - "--job-name=<%= job_name.blank? ? jupyter_notebook : job_name.to_s %>"

Also, 2 things to note here. You want to use <%= %> type syntax (as a pose to <% %>) because that will enforce things to be strings. Secondly you have job_name.to_i which is the ‘to integer’ function. You want to_s (to string) instead.