# Module: `kernel.restarter`

A basic kernel monitor with autorestarting.

This watches a kernel’s state using KernelManager.is_alive and auto restarts the kernel if it dies.

It is an incomplete base class, and must be subclassed.

## 1 Class

class `IPython.kernel.restarter.``KernelRestarter`(**kwargs)

  Bases: `IPython.config.configurable.LoggingConfigurable`

  Monitor and autorestart a kernel.

  `add_callback`(f, event='restart')

    register a callback to fire on a particular event

    Possible values for event:

    > ‘restart’ (default): kernel has died, and will be restarted. ‘dead’: restart has failed, kernel will be left dead.

  `remove_callback`(f, event='restart')

    unregister a callback to fire on a particular event

    Possible values for event:

    > ‘restart’ (default): kernel has died, and will be restarted. ‘dead’: restart has failed, kernel will be left dead.

  `start`()

    Start the polling of the kernel.

  `stop`()

    Stop the kernel polling.