I’m going to deploy jupyterhub with nbgrader for a course. Would it be possible to stop server upon logout? is it recommended? what are the consequences? how can I stop inactive servers after some time in z2jh?
are setting these options enough to achieve that?
Update:
As far as I understood from the tutorial, cull idle is a service running on the hub and will kill inactive singleusers servers. But in order for that to work, according to Customizing User Management — Zero to JupyterHub with Kubernetes documentation one should mount jupyterhub_notebook_config.json in /etc/jupyter to send signal to the hub. Is it correct?
I followed the instruction in the mentioned page and added the below code
singleuser:
extraFiles:
# jupyter_notebook_config reference: https://jupyter-notebook.readthedocs.io/en/stable/config.html
jupyter_notebook_config.json:
mountPath: /etc/jupyter/jupyter_notebook_config.json
# data is a YAML structure here but will be rendered to JSON file as our
# file extension is ".json".
data:
MappingKernelManager:
# cull_idle_timeout: timeout (in seconds) after which an idle kernel is
# considered ready to be culled
cull_idle_timeout: 1200 # default: 0
# cull_interval: the interval (in seconds) on which to check for idle
# kernels exceeding the cull timeout value
cull_interval: 120 # default: 300
# cull_connected: whether to consider culling kernels which have one
# or more connections
cull_connected: true # default: false
# cull_busy: whether to consider culling kernels which are currently
# busy running some code
cull_busy: false # default: false
But it didn’t work with this error:
2024-01-15T13:29:19Z [Warning] Error: failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/var/lib/kubelet/pods/5cd8b5c0-3652-4716-b0cc-5bfb6e5a72df/volume-subpaths/files/notebook/1" to rootfs at "/etc/jupyter/jupyter_notebook_config.json": mount /var/lib/kubelet/pods/5cd8b5c0-3652-4716-b0cc-5bfb6e5a72df/volume-subpaths/files/notebook/1:/etc/jupyter/jupyter_notebook_config.json (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown
What should be the contents of jupyterhub_notebook_config.json so that I can add it using a configMap?
A user can have multiple servers running if the named servers functionality is activated. The hub remains running, but all the servers owned by the logging out user will be shut down.
Thank you! If I can make a suggestion, I think the docs for shutdown_on_logout could be improved with your note. As is, it’s tough to interpret that’s the expected behavior.