# slurmformspawner
JupyterHub SlurmSpawner with a dynamic spawn form
## Requirements
- Python >= 3.7
- JupyterHub >= 4.0.0
- batchspawner>= 1.3.0
- cachetools
- traitlets
## Configuration
### SlurmFormSpawner
| Variable | Type | Description | Default |
| --------------------------------- | :------ | :---------------------------------------------- | ------- |
| `c.SlurmFormSpawner.disable_form` | `CBool` | Disable the spawner input form, use only default values instead | `False` |
| `c.SlurmFormSpawner.error_template_path` | `Unicode` | Path to the Jinja2 template of the error page | `os.path.join(sys.prefix, 'share', 'slurmformspawner', 'templates', 'error.html')` |
| `c.SlurmFormSpawner.submit_template_path` | `Unicode` | Path to the Jinja2 template of the submit file | `os.path.join(sys.prefix, 'share', 'slurmformspawner', 'templates', 'submit.sh')` |
| `c.SlurmFormSpawner.ui_args` | `Dict` | Dictionary of dictionaries describing the UI options | refer to `ui_args` section |
| `c.SlurmFormSpawner.profile_args` | `Dict` | Dictionary of dictionaries describing profiles | refer to `profile_args` section |
#### `ui_args`
`ui_args` is a dictionary where the keys are labels that will be re-used in `SbatchForm.ui` and the values are dictionnaries describing how to launch the user interface.
Each option dictionary can have the following keys:
- `name` (required): string that will appear in the Spawner form
- `url` (optional): url user is being redirected to after spawning the single-user server (refer to `JUPYTERHUB_DEFAULT_URL` documentation)
- `args` (optional): list of flags and options that will be appended to jupyter single-user command that should redirect to the UI.
- `modules` (optional): list of module names that needs to be loaded to make the user interface work
Here is an example of a dictionary that would configure Jupyter Notebook, a terminal and RStudio.
```
c.SlurmFormSpawner.ui_args = {
'notebook' : {
'name': 'Jupyter Notebook'
},
'terminal' : {
'name': 'Terminal',
'url': '/terminal/1'
},
'rstudio' : {
'name': 'RStudio',
'url': '/rstudio',
'modules': ['rstudio-server']
}
}
```
#### `profile_args`
`profile_args` is a dictionary where the keys are labels that are used in a JavaScript function to set values of the form according values specified in the `params` sub dictionary.
Each dictionary has the following keys:
- `name` (required): string that will appear in the Spawner form
- `params` (required): dictionary that can specify the value of each of the parameters in SbatchForm (see SbatchForm section).
Here is an example of how you could define profiles
```
c.SlurmFormSpawner.profile_args = {
'shell' : {
'name': 'Shell session',
'params': {
'nprocs': 1,
'oversubscribe': True,
'ui': 'terminal'
}
},
'parallel_testing' : {
'name': 'Parallel Testing',
'params': {
'nprocs': 8,
'oversubscribe': False,
'ui': 'lab',
'runtime': 1,
}
}
}
```
### SbatchForm
| Variable | Type | Description | Default |
| --------------------------------- | :------ | :---------------------------------------------- | ------- |
| `c.SbatchForm.runtime` | `Dict({'max', 'min', 'step', 'lock', 'def'})` | Runtime widget parameters | refer to `form.py` |
| `c.SbatchForm.nprocs` | `Dict({'max', 'min', 'step', 'lock', 'def'})` | Number of cores widget parameters | refer to `form.py` |
| `c.SbatchForm.memory` | `Dict({'max', 'min', 'step', 'lock', 'def'})` | Memory (MB) widget parameters | refer to `form.py` |
| `c.SbatchForm.oversubscribe` | `Dict({'def', 'lock'})` | Oversubscribe widget parameters | refer to `form.py` |
| `c.SbatchForm.gpus` | `Dict({'def', 'choices', 'lock'})` | GPUs widget parameters | refer to `form.py` |
| `c.SbatchForm.ui` | `Dict({'def', 'choices', 'lock'})` | User interface widget parameters | refer to `form.py` |
| `c.SbatchForm.profile` | `Dict({'def', 'choices', 'lock'})` | User interface widget parameters | refer to `form.py` |
| `c.SbatchForm.reservation` | `Dict({'def', 'choices', 'lock'})` | Reservation widget parameters | refer to `form.py` |
| `c.SbatchForm.account` | `Dict({'def', 'choices', 'lock'})` | Account widget parameters | refer to `form.py` |
| `c.SbatchForm.partition` | `Dict({'def', 'choices', 'lock'})` | Slurm partition parameters | refer to `form.py` |
| `c.SbatchForm.form_template_path` | `Unicode` | Path to the Jinja2 template of the form | `os.path.join(sys.prefix, 'share', 'slurmformspawner', 'templates', 'form.html')` |
### SlurmAPI
| Variable | Type | Description | Default |
| --------------------------------- | :-------- | :---------------------------------------------------------------- | ------- |
| `c.SlurmAPI.info_cache_ttl` | `Integer` | Slurm sinfo output cache time-to-live (seconds) | 300 |
| `c.SlurmAPI.acct_cache_ttl` | `Integer` | Slurm sacct output cache time-to-live (seconds) | 300 |
| `c.SlurmAPI.acct_cache_size` | `Integer` | Slurm sacct output cache size (number of users) | 100 |
| `c.SlurmAPI.res_cache_ttl` | `Integer` | Slurm scontrol (reservations) output cache time-to-live (seconds) | 300 |
## screenshot

Raw data
{
"_id": null,
"home_page": "https://github.com/cmd-ntrf/slurmformspawner",
"name": "slurmformspawner",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Interactive, Web, JupyterHub",
"author": "F\u00e9lix-Antoine Fortin",
"author_email": "felix-antoine.fortin@calculquebec.ca",
"download_url": "https://files.pythonhosted.org/packages/5b/83/9af48a949db49e4e6fbb7d71285bc5d27cc003d3cbc31867b104fbcb32f0/slurmformspawner-2.9.2.tar.gz",
"platform": "Linux",
"description": "# slurmformspawner\nJupyterHub SlurmSpawner with a dynamic spawn form\n\n## Requirements\n\n- Python >= 3.7\n- JupyterHub >= 4.0.0\n- batchspawner>= 1.3.0\n- cachetools\n- traitlets\n\n## Configuration\n\n### SlurmFormSpawner\n\n| Variable | Type | Description | Default |\n| --------------------------------- | :------ | :---------------------------------------------- | ------- |\n| `c.SlurmFormSpawner.disable_form` | `CBool` | Disable the spawner input form, use only default values instead | `False` |\n| `c.SlurmFormSpawner.error_template_path` | `Unicode` | Path to the Jinja2 template of the error page | `os.path.join(sys.prefix, 'share', 'slurmformspawner', 'templates', 'error.html')` |\n| `c.SlurmFormSpawner.submit_template_path` | `Unicode` | Path to the Jinja2 template of the submit file | `os.path.join(sys.prefix, 'share', 'slurmformspawner', 'templates', 'submit.sh')` |\n| `c.SlurmFormSpawner.ui_args` | `Dict` | Dictionary of dictionaries describing the UI options | refer to `ui_args` section |\n| `c.SlurmFormSpawner.profile_args` | `Dict` | Dictionary of dictionaries describing profiles | refer to `profile_args` section |\n\n#### `ui_args`\n\n`ui_args` is a dictionary where the keys are labels that will be re-used in `SbatchForm.ui` and the values are dictionnaries describing how to launch the user interface.\nEach option dictionary can have the following keys:\n- `name` (required): string that will appear in the Spawner form\n- `url` (optional): url user is being redirected to after spawning the single-user server (refer to `JUPYTERHUB_DEFAULT_URL` documentation)\n- `args` (optional): list of flags and options that will be appended to jupyter single-user command that should redirect to the UI.\n- `modules` (optional): list of module names that needs to be loaded to make the user interface work\n\nHere is an example of a dictionary that would configure Jupyter Notebook, a terminal and RStudio.\n```\nc.SlurmFormSpawner.ui_args = {\n 'notebook' : {\n 'name': 'Jupyter Notebook'\n },\n 'terminal' : {\n 'name': 'Terminal',\n 'url': '/terminal/1'\n },\n 'rstudio' : {\n 'name': 'RStudio',\n 'url': '/rstudio',\n 'modules': ['rstudio-server']\n }\n}\n```\n\n#### `profile_args`\n`profile_args` is a dictionary where the keys are labels that are used in a JavaScript function to set values of the form according values specified in the `params` sub dictionary.\n\nEach dictionary has the following keys:\n- `name` (required): string that will appear in the Spawner form\n- `params` (required): dictionary that can specify the value of each of the parameters in SbatchForm (see SbatchForm section).\n\nHere is an example of how you could define profiles\n```\nc.SlurmFormSpawner.profile_args = {\n 'shell' : {\n 'name': 'Shell session',\n 'params': {\n 'nprocs': 1,\n 'oversubscribe': True,\n 'ui': 'terminal'\n }\n },\n 'parallel_testing' : {\n 'name': 'Parallel Testing',\n 'params': {\n 'nprocs': 8,\n 'oversubscribe': False,\n 'ui': 'lab',\n 'runtime': 1,\n }\n }\n}\n```\n\n### SbatchForm\n\n| Variable | Type | Description | Default |\n| --------------------------------- | :------ | :---------------------------------------------- | ------- |\n| `c.SbatchForm.runtime` | `Dict({'max', 'min', 'step', 'lock', 'def'})`\u00a0| Runtime widget parameters | refer to `form.py` |\n| `c.SbatchForm.nprocs` | `Dict({'max', 'min', 'step', 'lock', 'def'})`\u00a0| Number of cores widget parameters | refer to `form.py` |\n| `c.SbatchForm.memory` | `Dict({'max', 'min', 'step', 'lock', 'def'})` | Memory (MB) widget parameters | refer to `form.py` |\n| `c.SbatchForm.oversubscribe` | `Dict({'def', 'lock'})` | Oversubscribe widget parameters | refer to `form.py` |\n| `c.SbatchForm.gpus` | `Dict({'def', 'choices', 'lock'})` | GPUs widget parameters | refer to `form.py` |\n| `c.SbatchForm.ui` | `Dict({'def', 'choices', 'lock'})` | User interface widget parameters | refer to `form.py` |\n| `c.SbatchForm.profile` | `Dict({'def', 'choices', 'lock'})` | User interface widget parameters | refer to `form.py` |\n| `c.SbatchForm.reservation` | `Dict({'def', 'choices', 'lock'})` | Reservation widget parameters | refer to `form.py` |\n| `c.SbatchForm.account` | `Dict({'def', 'choices', 'lock'})` | Account widget parameters | refer to `form.py` |\n| `c.SbatchForm.partition` | `Dict({'def', 'choices', 'lock'})` | Slurm partition parameters | refer to `form.py` |\n| `c.SbatchForm.form_template_path` | `Unicode` | Path to the Jinja2 template of the form | `os.path.join(sys.prefix, 'share', 'slurmformspawner', 'templates', 'form.html')` |\n\n### SlurmAPI\n\n| Variable | Type | Description | Default |\n| --------------------------------- | :-------- | :---------------------------------------------------------------- | ------- |\n| `c.SlurmAPI.info_cache_ttl` | `Integer`\u00a0| Slurm sinfo output cache time-to-live (seconds) | 300 |\n| `c.SlurmAPI.acct_cache_ttl` | `Integer`\u00a0| Slurm sacct output cache time-to-live (seconds) | 300 |\n| `c.SlurmAPI.acct_cache_size` | `Integer`\u00a0| Slurm sacct output cache size (number of users) | 100 |\n| `c.SlurmAPI.res_cache_ttl` | `Integer`\u00a0| Slurm scontrol (reservations) output cache time-to-live (seconds) | 300 |\n\n## screenshot\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "slurmformspawner: JupyterHub SlurmSpawner with a dynamic spawn form",
"version": "2.9.2",
"project_urls": {
"Homepage": "https://github.com/cmd-ntrf/slurmformspawner"
},
"split_keywords": [
"interactive",
" web",
" jupyterhub"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a4290d050ab01c7f65c16ec5d3c65483185522f0f1113eddc7ae0084dfbbbd9a",
"md5": "686421a6f09a5b086781f9b2724e4b25",
"sha256": "604f9409655b5bf336b5679174a6875ee3c0395a6a93cb28ca9b69af40669d51"
},
"downloads": -1,
"filename": "slurmformspawner-2.9.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "686421a6f09a5b086781f9b2724e4b25",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 21415,
"upload_time": "2025-08-18T15:51:47",
"upload_time_iso_8601": "2025-08-18T15:51:47.903530Z",
"url": "https://files.pythonhosted.org/packages/a4/29/0d050ab01c7f65c16ec5d3c65483185522f0f1113eddc7ae0084dfbbbd9a/slurmformspawner-2.9.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5b839af48a949db49e4e6fbb7d71285bc5d27cc003d3cbc31867b104fbcb32f0",
"md5": "4f6a238084220bf47d827c1053f4ee39",
"sha256": "f21d63445be63f81521c11acd7d7a9ea113edc4231e0feeab43272f6adc63724"
},
"downloads": -1,
"filename": "slurmformspawner-2.9.2.tar.gz",
"has_sig": false,
"md5_digest": "4f6a238084220bf47d827c1053f4ee39",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 22004,
"upload_time": "2025-08-18T15:51:49",
"upload_time_iso_8601": "2025-08-18T15:51:49.429921Z",
"url": "https://files.pythonhosted.org/packages/5b/83/9af48a949db49e4e6fbb7d71285bc5d27cc003d3cbc31867b104fbcb32f0/slurmformspawner-2.9.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-18 15:51:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cmd-ntrf",
"github_project": "slurmformspawner",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "slurmformspawner"
}