SwissDataScienceCenter / amalthea

A kubernetes operator for spawning and exposing jupyter servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement idle session cleanup

olevski opened this issue · comments

I wanted to summarize my ideas/findings on this somewhere.

Any juptyer server has an endpoint at /api/status that provides the following information:

{
  "connections": 0, 
  "kernels": 0, 
  "last_activity": 
  "2021-08-11T16:37:19.604856Z", 
  "started": "2021-08-11T16:37:14.672279Z"
}

This can be easily utilized to check and determine whether a session is idle or not and get rid of it.

Kopf also provides a timer that can be made to get triggered at specific intervals and perform such a check. See https://kopf.readthedocs.io/en/stable/timers/.

The questions that remain are:

  • how does kopf access the sessions - currently they are protected by auth / proxy which would prevent the access to the servers
  • the above question is related to a broader question on how real-time or periodically queried information about sessions are shared with other services/components that need them

closed through #68