Hi folks - this is Jagane Sundar of InfinStor. I’m working on our free cloud hosted Jupyterhub as a Service offering and this issue of idle detect has popped up. Our spawner spins up a single cloud VM for each jupyterlab user and shuts it down upon idle. We want aggressive idle detect since cloud VMs, especially ones with a GPU, are expensive. Note that we run jupyterlab inside a container inside a VM (1-1 relationship between container and VM), and we preserve the contents of the container and VM by not removing the container and by stopping the VM instead of terminating it. This means that the contents of the jupyterlab such as notebooks, downloaded data etc. are not lost when jupyter server is stopped.
We are using the following settings in the jupyter notebook server:
c.ServerApp.shutdown_no_activity_timeout = 10 * 60
c.MappingKernelManager.cull_idle_timeout = 10 * 60
c.MappingKernelManager.cull_interval = 1 * 60
c.MappingKernelManager.cull_connected = True
That is to say, cull idle kernels after 10 minutes of inactivity, and stop the jupyter server 10 minutes of idle after the last kernel has been terminated. In addition, on the jupyterhub side, we have the following configuration snippet:
c.JupyterHub.services = [
{
'name': 'idle-culler',
'admin': True,
'command': [sys.executable, '-m', 'jupyterhub_idle_culler', '--timeout=1800'],
}
]
This jupyterhub idle-culler is meant to be a fall back and stops jupyterlabs after 30 minutes of idle.
Now, here’s what I’m observing: unless I’m completely mistaken, the javascript code in the browser sends a poll of some kind whenever the jupyterlab browser tab is visible. Hence the idle culler never kicks in if the browser tab is visible. Am I correct in this observation?
I would like to configure it such that only the following are considered activity:
- mouse click in the jupyterlab browser tab, not mouse movement
- keystokes in the jupyterlab browser tab
- one or more kernels doing computation work
Is there a way for me to configure the jupyterlab/hub in this manner?
Cheers, and thank you folks for creating this awesome piece of software.