Detect Idle Sessions

Dear OOD,

Is there a way we can detect idle sessions. For example a user requests an interactive Jupyter-notebook uses it for few minutes closes the browser and then leaves the job running until its expiration time. I understand this is more of an education thing to the users, but a bit unhappy about how users request an interactive session for N > 12 hours of the job and leave it unused after 5 minutes. We could make interactive sessions short but that might not work some good users. Any thoughts on how others are dealing with this? Not sure if I want to police and ping every user on this, but would like to be alerted on such sessions if possible and as a first step identify how much of an issue this is.

Thank you,

1 Like

Hi! Welcome! That’s a great question, that I’m not sure anyone has solved.

Here’s how I’d go about it: the easiest way right now would be in the job itself. On the server side it’d be hard/non-trivial to detect a session, the detect that it’s idle.

But in the job itself, it would be easy enough to background a simple shell script that maybe, every 5 minutes or so looks for active (ESTABLISHED or TIME_WAIT) tcp connections to jupyter, if there are none or have been none for say 15 minutes, kills jupyter (or delete the job if you don’t know the PID). I think that’s the best bet.

Hi Jeff,

Thank you for the Welcome. I can certainly do this from the job node itself as you suggest. But was wondering if there was alternative mechanism from within OOD. Thank you for the hint, will try it out and waste some of my time to save time on precious compute nodes :slight_smile: if at all it turns out to be a big waste.

Best Regards,

Hi, I’m moving this to feature request as someone should be able to provide a working example of this at some point, and it would likely be helpful to some folks.