jupyterhub / systemdspawner

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

systemdspawner doesn't activate cpu_limit in v219 systemd #72

Closed whositwhatnow closed 1 year ago

whositwhatnow commented 4 years ago

Bug description The class cpu_limit doesn't work. I've applied but the maximum number of CPUs used are 0.25 (in a server with 192)

Expected behaviour The handling of cpu_limit, allowing the maximum per user.

Actual behaviour The amount of CPU used are always ONE

How to reproduce With a systemd v219, apply the systemdspawner and set c.SystemdSpawner.cpu_limit = X

Your personal set up OS: Linux Version: Red Hat 7 JupyterHub: 1.1.0

Similar to #69 post.

I've set the CPU limit to 0.25, and it does not seem to activate that limit.

systemdspawner configuration

c.SystemdSpawner.mem_limit = '1G'
c.SystemdSpawner.cpu_limit = 0.25
c.SystemdSpawner.user_workingdir = '/home/{USERNAME}'
#c.SystemdSpawner.username_template = 'jupyter-{USERNAME}'
#c.SystemdSpawner.default_shell = '/bin/bash'
#c.SystemdSpawner.extra_paths = ['/home/{USERNAME}/conda/bin']
c.SystemdSpawner.unit_name_template = 'jupyter-{USERNAME}-singleuser'
#c.SystemdSpawner.unit_extra_properties = {'LimitNOFILE': '16384'}
#c.SystemdSpawner.isolate_tmp = True
#c.SystemdSpawner.isolate_devices = True
#c.SystemdSpawner.disable_user_sudo = True
#c.SystemdSpawner.readonly_paths = ['/']
#c.SystemdSpawner.readwrite_paths = ['/home/user/{USERNAME}']
#c.SystemdSpawner.dynamic_users = True

results from log, I've only added the quota portion:

CPUAccounting=yes
CPUShares=18446744073709551615
StartupCPUShares=18446744073709551615
CPUQuotaPerSecUSec=250ms
BlockIOAccounting=no
BlockIOWeight=18446744073709551615
StartupBlockIOWeight=18446744073709551615
MemoryAccounting=yes
MemoryLimit=1073741824
consideRatio commented 1 year ago

I'll go for a close here, v0.17 is broken without systemd 243+ and to be released v1.0.0 will require v243+ where this isn't expected to be an issue any more.