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 handle cpu_limit in v219 systemd #69

Closed valvesss closed 1 year ago

valvesss commented 4 years ago

Bug description

The class cpu_limit doesn't work. I've applied but the maximum number os CPUs used are 1 (in a server with 24)

Expected behaviour

The handling of cpu_limit, allowing the maximum per user.

Actual behaviour

The ammount 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

yuvipanda commented 4 years ago

Thanks for reporting this. When your user is running inside the systemd service, can you find what the full manifest of the systemd service is? I think systemctl show jupyter-<your-user-name>-singleuser should show you

valvesss commented 4 years ago

Thanks for reporting this. When your user is running inside the systemd service, can you find what the full manifest of the systemd service is? I think systemctl show jupyter-<your-user-name>-singleuser should show you

Restart=no NotifyAccess=none RestartUSec=100ms TimeoutStartUSec=1min 30s TimeoutStopUSec=1min 30s WatchdogUSec=0 WatchdogTimestampMonotonic=0 StartLimitInterval=10000000 StartLimitBurst=5 StartLimitAction=none FailureAction=none PermissionsStartOnly=no RootDirectoryStartOnly=no RemainAfterExit=no GuessMainPID=yes MainPID=0 ControlPID=0 FileDescriptorStoreMax=0 StatusErrno=0 Result=success ExecMainStartTimestampMonotonic=0 ExecMainExitTimestampMonotonic=0 ExecMainPID=0 ExecMainCode=0 ExecMainStatus=0 MemoryCurrent=18446744073709551615 TasksCurrent=18446744073709551615 Delegate=no CPUAccounting=no CPUShares=18446744073709551615 StartupCPUShares=18446744073709551615 CPUQuotaPerSecUSec=infinity BlockIOAccounting=no BlockIOWeight=18446744073709551615 StartupBlockIOWeight=18446744073709551615 MemoryAccounting=no MemoryLimit=18446744073709551615 DevicePolicy=auto TasksAccounting=no TasksMax=18446744073709551615 UMask=0022 LimitCPU=18446744073709551615 LimitFSIZE=18446744073709551615 LimitDATA=18446744073709551615 LimitSTACK=18446744073709551615 LimitCORE=18446744073709551615 LimitRSS=18446744073709551615 LimitNOFILE=65536 LimitAS=18446744073709551615 LimitNPROC=1031017 LimitMEMLOCK=65536 LimitLOCKS=18446744073709551615 LimitSIGPENDING=1031017 LimitMSGQUEUE=819200 LimitNICE=0 LimitRTPRIO=0 LimitRTTIME=18446744073709551615 OOMScoreAdjust=0 Nice=0 IOScheduling=0 CPUSchedulingPolicy=0 CPUSchedulingPriority=0 TimerSlackNSec=50000 CPUSchedulingResetOnFork=no NonBlocking=no StandardInput=null StandardOutput=inherit StandardError=inherit TTYReset=no TTYVHangup=no TTYVTDisallocate=no SyslogPriority=30 SyslogLevelPrefix=yes SecureBits=0 CapabilityBoundingSet=18446744073709551615 AmbientCapabilities=0 MountFlags=0 PrivateTmp=no PrivateNetwork=no PrivateDevices=no ProtectHome=no ProtectSystem=no SameProcessGroup=no IgnoreSIGPIPE=yes NoNewPrivileges=no SystemCallErrorNumber=0 RuntimeDirectoryMode=0755 KillMode=control-group KillSignal=15 SendSIGKILL=yes SendSIGHUP=no Id=jupyter-jupyter-singleuser.service Names=jupyter-jupyter-singleuser.service Description=jupyter-jupyter-singleuser.service LoadState=not-found ActiveState=inactive SubState=dead InactiveExitTimestampMonotonic=0 ActiveEnterTimestampMonotonic=0 ActiveExitTimestampMonotonic=0 InactiveEnterTimestampMonotonic=0 CanStart=yes CanStop=yes CanReload=no CanIsolate=no StopWhenUnneeded=no RefuseManualStart=no RefuseManualStop=no AllowIsolate=no DefaultDependencies=yes OnFailureJobMode=replace IgnoreOnIsolate=no IgnoreOnSnapshot=no NeedDaemonReload=no JobTimeoutUSec=0 JobTimeoutAction=none ConditionResult=no AssertResult=no ConditionTimestampMonotonic=0 AssertTimestampMonotonic=0 LoadError=org.freedesktop.DBus.Error.FileNotFound "No such file or directory" Transient=no

I can send what ever you need to help me 'debug' this :). Thanks for answering BTW.

yuvipanda commented 4 years ago

I see CPUAccounting set to no and no CPUQuota, which shouldn't be the case if cpu_limit is set (per https://github.com/jupyterhub/systemdspawner/blob/master/systemdspawner/systemdspawner.py#L269)

Can you paste your jupyterhub_config.py file?

valvesss commented 4 years ago

I see CPUAccounting set to no and no CPUQuota, which shouldn't be the case if cpu_limit is set (per https://github.com/jupyterhub/systemdspawner/blob/master/systemdspawner/systemdspawner.py#L269)

Can you paste your jupyterhub_config.py file?

c.Authenticator.admin_users = { 'jupyter', 'jupy' } c.JupyterHub.spawner_class = 'systemdspawner.SystemdSpawner' c.JupyterHub.ip = 'x.x.x.x' c.JupyterHub.port = 443 c.SystemdSpawner.notebook_dir = '/analytics' c.SystemdSpawner.cpu_limit = 6.0 c.PAMAuthenticator.open_sessions = False c.JupyterHub.ssl_cert = '/etc/jupyterhub/jupyter.crt' c.JupyterHub.ssl_key = '/etc/jupyterhub/jupyter.key'

Maybe we have found a problem? The config isn't being effective?... I'm here to what ever you need.

valvesss commented 4 years ago

Any update? Tks

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.