[IPython-dev] Reaping idle ipython server instances

Thomas Kluyver takowl at gmail.com
Thu Dec 19 20:23:36 EST 2013


On 19 December 2013 16:35, Stephen Chan <sychan at lbl.gov> wrote:

>     Ideally the ipython server would simply notice that there has been
> no activity, and no active client sessions after some period of time
> and then politely exit. But that may be wishful thinking.
>

An idle server may still have open kernels which are storing state, but
users often don't stop the kernel when they close a notebook. So the tricky
question is when to kill off an idle kernel, as that destroys some
information. The notebook server is easier, because AFAIK, all its
information is stored on disk, so you can always bring it back up later.


>     The generic docker approach seems to be to monitor network
> activity periodically and if there isn't any, shutdown the container
> using the docker API. I can do this, though I am worried about long
> running tasks that may result in the network traffic being idle while
> its running.
>

The kernels do send busy and idle messages, so if you monitor these, you
should be able to avoid killing long running jobs. That probably requires a
custom solution, not a generic docker monitor, though.

http://ipython.org/ipython-doc/dev/development/messaging.html#kernel-status

Best wishes,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20131219/966829e3/attachment.html>


More information about the IPython-dev mailing list