jupyterhub / systemdspawner

Spawn JupyterHub single-user notebook servers with systemd
BSD 3-Clause "New" or "Revised" License
92 stars 45 forks source link

Allow setting nice (process scheduling priority) #85

Open mathause opened 3 years ago

mathause commented 3 years ago

Proposed change

systemd-run allows to set the niceness level with systemd-run --nice=19 .... Would be nice if we could spawn kernels with reduced niceness to reduce their priority.

Alternative options

Who would use this feature?

Sysadmins who'd like to reduce the priority of the kernels run on the system.

(Optional): Suggest a solution

    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.

mathause commented 3 years ago

It might actually work via property. However, I could not really test it as the systemd version of my servers is still too old (currently: systemd 234; required systemd 244 (or 246) and higher). For a quick test:

systemd-run --user --pty --quiet --nice=19 nice
systemd-run --user --pty --quiet --property=Nice=19 nice

both lines should return 19. Neither version works in systemd 234 but work on systemd 246. Thus the issue can be closed.