jupyterhub / jupyterhub/systemdspawner
Allow setting nice (process scheduling priority)
- Dominant language
- Python
- Stars
- 100
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Description
### Proposed change
`systemd-run` allows to [set the niceness level](https://www.freedesktop.org/software/systemd/man/systemd-run.html#--nice=) with `systemd-run --nice=19 ...`. Would be _nice_ if we could spawn kernels with reduced niceness to reduce their priority.
### Alternative options
- it might be possible to start a slice with a given niceness and start the kernels in this slice
- or jupyterhub itself could be run with reduced niceness and the kernels would inherit this (although this is not desirable)
- I think it's _not_ possible to set the niceness via `--property=Nice=19` - Let me know if I am wrong.
### Who would use this feature?
Sysadmins who'd like to reduce the priority of the kernels run on the system.
### (Optional): Suggest a solution
- add a `Nice` traitlet to `SystemdSpawner`, defaulting to `None`
- expand the `systemd-run` command in `start_transient_service`
```python
if nice is not None:
run_cmd += ['--nice={}'.format(nice)]
```
---
I am happy to open a PR if there's a chance to get this in.
Contributor guide
Assessment
This issue has not been assessed yet.