<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Module: kernel.manager — IPython 2.3.0 documentation</title> <link rel="stylesheet" href="../../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../../', VERSION: '2.3.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../../_static/jquery.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script> <link rel="top" title="IPython 2.3.0 documentation" href="../../index.html" /> <link rel="up" title="The IPython API" href="../index.html" /> <link rel="next" title="Module: kernel.managerabc" href="IPython.kernel.managerabc.html" /> <link rel="prev" title="Module: kernel.launcher" href="IPython.kernel.launcher.html" /> </head> <body> <div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px"> <a href="http://ipython.org/"><img src="../../_static/logo.png" border="0" alt="IPython Documentation"/></a> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="IPython.kernel.managerabc.html" title="Module: kernel.managerabc" accesskey="N">next</a> |</li> <li class="right" > <a href="IPython.kernel.launcher.html" title="Module: kernel.launcher" accesskey="P">previous</a> |</li> <li><a href="http://ipython.org">home</a>| </li> <li><a href="../../search.html">search</a>| </li> <li><a href="../../index.html">documentation </a> »</li> <li><a href="../index.html" accesskey="U">The IPython API</a> »</li> </ul> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Module: <tt class="docutils literal"><span class="pre">kernel.manager</span></tt></a><ul> <li><a class="reference internal" href="#class">1 Class</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="IPython.kernel.launcher.html" title="previous chapter">Module: <tt class="docutils literal"><span class="pre">kernel.launcher</span></tt></a></p> <h4>Next topic</h4> <p class="topless"><a href="IPython.kernel.managerabc.html" title="next chapter">Module: <tt class="docutils literal"><span class="pre">kernel.managerabc</span></tt></a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../../_sources/api/generated/IPython.kernel.manager.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-IPython.kernel.manager"> <span id="module-kernel-manager"></span><h1>Module: <tt class="xref py py-mod docutils literal"><span class="pre">kernel.manager</span></tt><a class="headerlink" href="#module-IPython.kernel.manager" title="Permalink to this headline">¶</a></h1> <p>Base class to manage a running kernel</p> <div class="section" id="class"> <h2>1 Class<a class="headerlink" href="#class" title="Permalink to this headline">¶</a></h2> <dl class="class"> <dt id="IPython.kernel.manager.KernelManager"> <em class="property">class </em><tt class="descclassname">IPython.kernel.manager.</tt><tt class="descname">KernelManager</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.kernel.manager.KernelManager" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="IPython.config.configurable.html#IPython.config.configurable.LoggingConfigurable" title="IPython.config.configurable.LoggingConfigurable"><tt class="xref py py-class docutils literal"><span class="pre">IPython.config.configurable.LoggingConfigurable</span></tt></a>, <a class="reference internal" href="IPython.kernel.connect.html#IPython.kernel.connect.ConnectionFileMixin" title="IPython.kernel.connect.ConnectionFileMixin"><tt class="xref py py-class docutils literal"><span class="pre">IPython.kernel.connect.ConnectionFileMixin</span></tt></a></p> <p>Manages a single kernel in a subprocess on this host.</p> <p>This version starts kernels with Popen.</p> <dl class="method"> <dt id="IPython.kernel.manager.KernelManager.add_restart_callback"> <tt class="descname">add_restart_callback</tt><big>(</big><em>callback</em>, <em>event='restart'</em><big>)</big><a class="headerlink" href="#IPython.kernel.manager.KernelManager.add_restart_callback" title="Permalink to this definition">¶</a></dt> <dd><p>register a callback to be called when a kernel is restarted</p> </dd></dl> <dl class="method"> <dt id="IPython.kernel.manager.KernelManager.client"> <tt class="descname">client</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#IPython.kernel.manager.KernelManager.client" title="Permalink to this definition">¶</a></dt> <dd><p>Create a client configured to connect to our kernel</p> </dd></dl> <dl class="method"> <dt id="IPython.kernel.manager.KernelManager.format_kernel_cmd"> <tt class="descname">format_kernel_cmd</tt><big>(</big><em>**kw</em><big>)</big><a class="headerlink" href="#IPython.kernel.manager.KernelManager.format_kernel_cmd" title="Permalink to this definition">¶</a></dt> <dd><p>replace templated args (e.g. {connection_file})</p> </dd></dl> <dl class="attribute"> <dt id="IPython.kernel.manager.KernelManager.has_kernel"> <tt class="descname">has_kernel</tt><a class="headerlink" href="#IPython.kernel.manager.KernelManager.has_kernel" title="Permalink to this definition">¶</a></dt> <dd><p>Has a kernel been started that we are managing.</p> </dd></dl> <dl class="method"> <dt id="IPython.kernel.manager.KernelManager.interrupt_kernel"> <tt class="descname">interrupt_kernel</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.kernel.manager.KernelManager.interrupt_kernel" title="Permalink to this definition">¶</a></dt> <dd><p>Interrupts the kernel by sending it a signal.</p> <p>Unlike <tt class="docutils literal"><span class="pre">signal_kernel</span></tt>, this operation is well supported on all platforms.</p> </dd></dl> <dl class="method"> <dt id="IPython.kernel.manager.KernelManager.is_alive"> <tt class="descname">is_alive</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.kernel.manager.KernelManager.is_alive" title="Permalink to this definition">¶</a></dt> <dd><p>Is the kernel process still running?</p> </dd></dl> <dl class="method"> <dt id="IPython.kernel.manager.KernelManager.remove_restart_callback"> <tt class="descname">remove_restart_callback</tt><big>(</big><em>callback</em>, <em>event='restart'</em><big>)</big><a class="headerlink" href="#IPython.kernel.manager.KernelManager.remove_restart_callback" title="Permalink to this definition">¶</a></dt> <dd><p>unregister a callback to be called when a kernel is restarted</p> </dd></dl> <dl class="method"> <dt id="IPython.kernel.manager.KernelManager.restart_kernel"> <tt class="descname">restart_kernel</tt><big>(</big><em>now=False</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#IPython.kernel.manager.KernelManager.restart_kernel" title="Permalink to this definition">¶</a></dt> <dd><p>Restarts a kernel with the arguments that were used to launch it.</p> <p>If the old kernel was launched with random ports, the same ports will be used for the new kernel. The same connection file is used again.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>now</strong> : bool, optional</p> <blockquote> <div><p>If True, the kernel is forcefully restarted <em>immediately</em>, without having a chance to do any cleanup action. Otherwise the kernel is given 1s to clean up before a forceful restart is issued.</p> <p>In all cases the kernel is restarted, the only difference is whether it is given a chance to perform a clean shutdown or not.</p> </div></blockquote> <p><strong>**kw</strong> : optional</p> <blockquote class="last"> <div><p>Any options specified here will overwrite those used to launch the kernel.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="IPython.kernel.manager.KernelManager.shutdown_kernel"> <tt class="descname">shutdown_kernel</tt><big>(</big><em>now=False</em>, <em>restart=False</em><big>)</big><a class="headerlink" href="#IPython.kernel.manager.KernelManager.shutdown_kernel" title="Permalink to this definition">¶</a></dt> <dd><p>Attempts to the stop the kernel process cleanly.</p> <p>This attempts to shutdown the kernels cleanly by:</p> <ol class="arabic simple"> <li>Sending it a shutdown message over the shell channel.</li> <li>If that fails, the kernel is shutdown forcibly by sending it a signal.</li> </ol> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>now</strong> : bool</p> <blockquote> <div><p>Should the kernel be forcible killed <em>now</em>. This skips the first, nice shutdown attempt.</p> </div></blockquote> <p><strong>restart: bool</strong></p> <blockquote class="last"> <div><p>Will this kernel be restarted after it is shutdown. When this is True, connection files will not be cleaned up.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="IPython.kernel.manager.KernelManager.signal_kernel"> <tt class="descname">signal_kernel</tt><big>(</big><em>signum</em><big>)</big><a class="headerlink" href="#IPython.kernel.manager.KernelManager.signal_kernel" title="Permalink to this definition">¶</a></dt> <dd><p>Sends a signal to the kernel.</p> <p>Note that since only SIGTERM is supported on Windows, this function is only useful on Unix systems.</p> </dd></dl> <dl class="method"> <dt id="IPython.kernel.manager.KernelManager.start_kernel"> <tt class="descname">start_kernel</tt><big>(</big><em>**kw</em><big>)</big><a class="headerlink" href="#IPython.kernel.manager.KernelManager.start_kernel" title="Permalink to this definition">¶</a></dt> <dd><p>Starts a kernel on this host in a separate process.</p> <p>If random ports (port=0) are being used, this method must be called before the channels are created.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>**kw</strong> : optional</p> <blockquote class="last"> <div><p>keyword arguments that are passed down to build the kernel_cmd and launching the kernel (e.g. Popen kwargs).</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> </dd></dl> </div> </div> </div> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="IPython.kernel.managerabc.html" title="Module: kernel.managerabc" >next</a> |</li> <li class="right" > <a href="IPython.kernel.launcher.html" title="Module: kernel.launcher" >previous</a> |</li> <li><a href="http://ipython.org">home</a>| </li> <li><a href="../../search.html">search</a>| </li> <li><a href="../../index.html">documentation </a> »</li> <li><a href="../index.html" >The IPython API</a> »</li> </ul> </div> <div class="footer"> © Copyright The IPython Development Team. Last updated on Jul 14, 2015. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3. </div> </body> </html>