For my JupyterLab app, I want a text field for extra Slurm arguments. Here’s what I did:
form.yml
attributes:
extra_slurm_args:
label: Extra arguments for Slurm
widget: text_field
help: |
arguments documented in the [sbatch manual](https://slurm.schedmd.com/sbatch.html)
form:
- extra_slurm_args
submit.yml
script:
native:
- <%= extra_slurm_args.blank? ? "--clusters=unity" : extra_slurm_args.to_s %>
using clusters=unity
as my default value because an empty string doesn’t work, and this OOD instance will only ever serve the “unity” cluster.
This works with one argument. I can use -w <hostname>
in that text field and it works as expected. It breaks when I try to use multiple arguments. -w <hostname> --export=EDITOR
fails like this: slurm_allocate_resources error opening file
. The Slurm source code prints that error when it fails to open a “host-file”, so it seems that my export
has become part of the -w --nodelist
argument. I think it’s because both arguments are one entry in the native
list, which I assume translates to argv
.
So I need a way to take a text field, split it into an array by spaces, and append each element in the resulting array to my native
list.
It seems like a difficult problem, but surely I’m not the first to try and implement custom slurm arguments in a batch connect form; Right?