We have a custom implementation of provisioning JupyterLab instances for our users and they can specify that their instance should be shut down automatically after X hours of inactivity. For that, we periodically query
/api/kernels endpoint of the JupyterLab and look if there is any kernel with
execution_state=busy and if not then we compare the
last_activity timestamps and decide whether the instance should be shut down or not according to the user’s setting.
This worked quite well until now when we found out that there is a running instance that should be already terminated for several days. It has a kernel with
execution_state=busy but its
last_activity is four days ago. The user was not working with it since then. Is this some glitch in the Jupyter or is it some special situation that can legally happen? However, the API docs suggest it should not. It tells that
ISO 8601 timestamp for the last-seen activity on this kernel.
Use this in combination with execution_state == ‘idle’ to identify
which kernels have been idle since a given time.