Auto restart long-running kernels

51 views
Skip to first unread message

Jesus Castello

unread,
Dec 9, 2016, 9:09:23 AM12/9/16
to Project Jupyter
Hello,
I want to run a Jupyter notebook server for my students. My only concern is if someone runs code that takes too long to finish (or even worse, an infinite loop).

Is there a way to make a kernel auto restart after 10 seconds of running the same cell?

Alternatively, is it possible to limit each individual kernel to like 20% of total cpu usage?

Thank you!

MinRK

unread,
Dec 19, 2016, 7:44:46 AM12/19/16
to Project Jupyter

On Fri, Dec 9, 2016 at 3:09 PM, Jesus Castello <mat...@gmail.com> wrote:

Hello,
I want to run a Jupyter notebook server for my students. My only concern is if someone runs code that takes too long to finish (or even worse, an infinite loop).

Is there a way to make a kernel auto restart after 10 seconds of running the same cell?

This one would take some work, but is technically possible. Students do have access to interrupt and restart on their notebook page, so I would recommend using that, rather than doing it forcefully on their behalf.


Alternatively, is it possible to limit each individual kernel to like 20% of total cpu usage?

This can be done with cgroups, and is perhaps exposed in the most friendly way when using a service like docker or systemd to launch processes. JupyterHub 0.7 introduces exposure of these resource limits for spawners that support them (namely docker, kubernetes, systemd, but not simple local processes).

-Min


Thank you!

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/dbb1471b-1591-4df4-ac47-5096686d21e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages