| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763 | 
<!DOCTYPE html><!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--><!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--><head>  <meta charset="utf-8">    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <title>grpc.framework.foundation package — grpcio 1.2.0 documentation</title>                              <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />              <link rel="index" title="Index"              href="genindex.html"/>        <link rel="search" title="Search" href="search.html"/>    <link rel="top" title="grpcio 1.2.0 documentation" href="index.html"/>        <link rel="up" title="grpc.framework package" href="grpc.framework.html"/>        <link rel="next" title="grpc.framework.interfaces package" href="grpc.framework.interfaces.html"/>        <link rel="prev" title="grpc.framework.common package" href="grpc.framework.common.html"/>     <script src="_static/js/modernizr.min.js"></script></head><body class="wy-body-for-nav" role="document">     <div class="wy-grid-for-nav">        <nav data-toggle="wy-nav-shift" class="wy-nav-side">      <div class="wy-side-scroll">        <div class="wy-side-nav-search">                                <a href="index.html" class="icon icon-home"> grpcio                              </a>                                                <div class="version">                1.2.0              </div>                                <div role="search">  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">    <input type="text" name="q" placeholder="Search docs" />    <input type="hidden" name="check_keywords" value="yes" />    <input type="hidden" name="area" value="default" />  </form></div>                  </div>        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">                                                                                      <p class="caption"><span class="caption-text">Contents:</span></p><ul class="current"><li class="toctree-l1 current"><a class="reference internal" href="grpc.html">grpc package</a><ul class="current"><li class="toctree-l2 current"><a class="reference internal" href="grpc.html#subpackages">Subpackages</a><ul class="current"><li class="toctree-l3"><a class="reference internal" href="grpc.beta.html">grpc.beta package</a></li><li class="toctree-l3 current"><a class="reference internal" href="grpc.framework.html">grpc.framework package</a><ul class="current"><li class="toctree-l4 current"><a class="reference internal" href="grpc.framework.html#subpackages">Subpackages</a></li><li class="toctree-l4"><a class="reference internal" href="grpc.framework.html#module-grpc.framework">Module contents</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="grpc.html#module-grpc">Module contents</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="grpc.html#glossary">Glossary</a></li></ul>                              </div>      </div>    </nav>    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">            <nav class="wy-nav-top" role="navigation" aria-label="top navigation">                  <i data-toggle="wy-nav-top" class="fa fa-bars"></i>          <a href="index.html">grpcio</a>              </nav>            <div class="wy-nav-content">        <div class="rst-content">          <div role="navigation" aria-label="breadcrumbs navigation">  <ul class="wy-breadcrumbs">          <li><a href="index.html">Docs</a> »</li>                  <li><a href="grpc.html">grpc package</a> »</li>                  <li><a href="grpc.framework.html">grpc.framework package</a> »</li>              <li>grpc.framework.foundation package</li>              <li class="wy-breadcrumbs-aside">                                <a href="_sources/grpc.framework.foundation.rst.txt" rel="nofollow"> View page source</a>                        </li>      </ul>    <hr/></div>          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">           <div itemprop="articleBody">              <div class="section" id="grpc-framework-foundation-package"><h1>grpc.framework.foundation package<a class="headerlink" href="#grpc-framework-foundation-package" title="Permalink to this headline">¶</a></h1><div class="section" id="submodules"><h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2></div><div class="section" id="module-grpc.framework.foundation.abandonment"><span id="grpc-framework-foundation-abandonment-module"></span><h2>grpc.framework.foundation.abandonment module<a class="headerlink" href="#module-grpc.framework.foundation.abandonment" title="Permalink to this headline">¶</a></h2><p>Utilities for indicating abandonment of computation.</p><dl class="exception"><dt id="grpc.framework.foundation.abandonment.Abandoned"><em class="property">exception </em><code class="descclassname">grpc.framework.foundation.abandonment.</code><code class="descname">Abandoned</code><a class="reference internal" href="_modules/grpc/framework/foundation/abandonment.html#Abandoned"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.abandonment.Abandoned" title="Permalink to this definition">¶</a></dt><dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></p><p>Indicates that some computation is being abandoned.</p><p>Abandoning a computation is different than returning a value or raisingan exception indicating some operational or programming defect.</p></dd></dl></div><div class="section" id="module-grpc.framework.foundation.callable_util"><span id="grpc-framework-foundation-callable-util-module"></span><h2>grpc.framework.foundation.callable_util module<a class="headerlink" href="#module-grpc.framework.foundation.callable_util" title="Permalink to this headline">¶</a></h2><p>Utilities for working with callables.</p><dl class="class"><dt id="grpc.framework.foundation.callable_util.Outcome"><em class="property">class </em><code class="descclassname">grpc.framework.foundation.callable_util.</code><code class="descname">Outcome</code><a class="reference internal" href="_modules/grpc/framework/foundation/callable_util.html#Outcome"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome" title="Permalink to this definition">¶</a></dt><dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p><p>A sum type describing the outcome of some call.</p><dl class="attribute"><dt id="grpc.framework.foundation.callable_util.Outcome.kind"><code class="descname">kind</code><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.kind" title="Permalink to this definition">¶</a></dt><dd><p>One of Kind.RETURNED or Kind.RAISED respectively indicating that thecall returned a value or raised an exception.</p></dd></dl><dl class="attribute"><dt id="grpc.framework.foundation.callable_util.Outcome.return_value"><code class="descname">return_value</code><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.return_value" title="Permalink to this definition">¶</a></dt><dd><p>The value returned by the call. Must be present if kind isKind.RETURNED.</p></dd></dl><dl class="attribute"><dt id="grpc.framework.foundation.callable_util.Outcome.exception"><code class="descname">exception</code><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.exception" title="Permalink to this definition">¶</a></dt><dd><p>The exception raised by the call. Must be present if kind isKind.RAISED.</p></dd></dl><dl class="class"><dt id="grpc.framework.foundation.callable_util.Outcome.Kind"><em class="property">class </em><code class="descname">Kind</code><a class="reference internal" href="_modules/grpc/framework/foundation/callable_util.html#Outcome.Kind"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.Kind" title="Permalink to this definition">¶</a></dt><dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">enum.Enum</span></code></p><p>Identifies the general kind of the outcome of some call.</p><dl class="attribute"><dt id="grpc.framework.foundation.callable_util.Outcome.Kind.RAISED"><code class="descname">RAISED</code><em class="property"> = <object object></em><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.Kind.RAISED" title="Permalink to this definition">¶</a></dt><dd></dd></dl><dl class="attribute"><dt id="grpc.framework.foundation.callable_util.Outcome.Kind.RETURNED"><code class="descname">RETURNED</code><em class="property"> = <object object></em><a class="headerlink" href="#grpc.framework.foundation.callable_util.Outcome.Kind.RETURNED" title="Permalink to this definition">¶</a></dt><dd></dd></dl></dd></dl></dd></dl><dl class="function"><dt id="grpc.framework.foundation.callable_util.call_logging_exceptions"><code class="descclassname">grpc.framework.foundation.callable_util.</code><code class="descname">call_logging_exceptions</code><span class="sig-paren">(</span><em>behavior</em>, <em>message</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/callable_util.html#call_logging_exceptions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.callable_util.call_logging_exceptions" title="Permalink to this definition">¶</a></dt><dd><p>Calls a behavior in a try-except that logs any exceptions it raises.</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"><ul class="first simple"><li><strong>behavior</strong> – Any callable.</li><li><strong>message</strong> – A string to log if the behavior raises an exception.</li><li><strong>*args</strong> – Positional arguments to pass to the given behavior.</li><li><strong>**kwargs</strong> – Keyword arguments to pass to the given behavior.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><dl class="docutils"><dt>An Outcome describing whether the given behavior returned a value or raised</dt><dd><p class="first last">an exception.</p></dd></dl></p></td></tr></tbody></table></dd></dl><dl class="function"><dt id="grpc.framework.foundation.callable_util.with_exceptions_logged"><code class="descclassname">grpc.framework.foundation.callable_util.</code><code class="descname">with_exceptions_logged</code><span class="sig-paren">(</span><em>behavior</em>, <em>message</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/callable_util.html#with_exceptions_logged"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.callable_util.with_exceptions_logged" title="Permalink to this definition">¶</a></dt><dd><p>Wraps a callable in a try-except that logs any exceptions it raises.</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"><ul class="first simple"><li><strong>behavior</strong> – Any callable.</li><li><strong>message</strong> – A string to log if the behavior raises an exception.</li></ul></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><dl class="docutils"><dt>A callable that when executed invokes the given behavior. The returned</dt><dd><p class="first last">callable takes the same arguments as the given behavior but returns afuture.Outcome describing whether the given behavior returned a value orraised an exception.</p></dd></dl></p></td></tr></tbody></table></dd></dl></div><div class="section" id="module-grpc.framework.foundation.future"><span id="grpc-framework-foundation-future-module"></span><h2>grpc.framework.foundation.future module<a class="headerlink" href="#module-grpc.framework.foundation.future" title="Permalink to this headline">¶</a></h2><p>A Future interface.</p><p>Python doesn’t have a Future interface in its standard library. In the absenceof such a standard, three separate, incompatible implementations(concurrent.futures.Future, ndb.Future, and asyncio.Future) have appeared. Thisinterface attempts to be as compatible as possible withconcurrent.futures.Future. From ndb.Future it adopts a traceback-object accessormethod.</p><p>Unlike the concrete and implemented Future classes listed above, the Futureclass defined in this module is an entirely abstract interface that anyone mayimplement and use.</p><p>The one known incompatibility between this interface and the interface ofconcurrent.futures.Future is that this interface defines its own CancelledErrorand TimeoutError exceptions rather than raising the implementation-privateconcurrent.futures._base.CancelledError and thebuilt-in-but-only-in-3.3-and-later TimeoutError.</p><dl class="exception"><dt id="grpc.framework.foundation.future.CancelledError"><em class="property">exception </em><code class="descclassname">grpc.framework.foundation.future.</code><code class="descname">CancelledError</code><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#CancelledError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.CancelledError" title="Permalink to this definition">¶</a></dt><dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></p><p>Indicates that the computation underlying a Future was cancelled.</p></dd></dl><dl class="class"><dt id="grpc.framework.foundation.future.Future"><em class="property">class </em><code class="descclassname">grpc.framework.foundation.future.</code><code class="descname">Future</code><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future" title="Permalink to this definition">¶</a></dt><dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p><p>A representation of a computation in another control flow.</p><p>Computations represented by a Future may be yet to be begun, may be ongoing,or may have already completed.</p><dl class="method"><dt id="grpc.framework.foundation.future.Future.add_done_callback"><code class="descname">add_done_callback</code><span class="sig-paren">(</span><em>fn</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.add_done_callback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.add_done_callback" title="Permalink to this definition">¶</a></dt><dd><p>Adds a function to be called at completion of the computation.</p><p>The callback will be passed this Future object describing the outcome ofthe computation.</p><p>If the computation has already completed, the callback will be calledimmediately.</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"><strong>fn</strong> – A callable taking this Future object as its single parameter.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.framework.foundation.future.Future.cancel"><code class="descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.cancel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.cancel" title="Permalink to this definition">¶</a></dt><dd><p>Attempts to cancel the computation.</p><p>This method does not block.</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">Returns:</th><td class="field-body"><dl class="docutils"><dt>True if the computation has not yet begun, will not be allowed to take</dt><dd>place, and determination of both was possible without blocking. Falseunder all other circumstances including but not limited to thecomputation’s already having begun, the computation’s already havingfinished, and the computation’s having been scheduled for execution on aremote system for which a determination of whether or not it commencedbefore being cancelled cannot be made without blocking.</dd></dl></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.framework.foundation.future.Future.cancelled"><code class="descname">cancelled</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.cancelled"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.cancelled" title="Permalink to this definition">¶</a></dt><dd><p>Describes whether the computation was cancelled.</p><p>This method does not block.</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">Returns:</th><td class="field-body"><dl class="docutils"><dt>True if the computation was cancelled any time before its result became</dt><dd>immediately available. False under all other circumstances including butnot limited to this object’s cancel method not having been called andthe computation’s result having become immediately available.</dd></dl></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.framework.foundation.future.Future.done"><code class="descname">done</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.done"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.done" title="Permalink to this definition">¶</a></dt><dd><p>Describes whether the computation has taken place.</p><p>This method does not block.</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">Returns:</th><td class="field-body"><dl class="docutils"><dt>True if the computation is known to have either completed or have been</dt><dd>unscheduled or interrupted. False if the computation may possibly beexecuting or scheduled to execute later.</dd></dl></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.framework.foundation.future.Future.exception"><code class="descname">exception</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.exception"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.exception" title="Permalink to this definition">¶</a></dt><dd><p>Return the exception raised by the computation.</p><p>This method may return immediately or may block.</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>timeout</strong> – The length of time in seconds to wait for the computation toterminate or be cancelled, or None if this method should block untilthe computation is terminated or is cancelled no matter how long thattakes.</p></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><dl class="docutils"><dt>The exception raised by the computation, or None if the computation did</dt><dd><p class="first last">not raise an exception.</p></dd></dl></p></td></tr><tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple"><li><a class="reference internal" href="#grpc.framework.foundation.future.TimeoutError" title="grpc.framework.foundation.future.TimeoutError"><code class="xref py py-exc docutils literal"><span class="pre">TimeoutError</span></code></a> – If a timeout value is passed and the computation does notterminate within the allotted time.</li><li><a class="reference internal" href="#grpc.framework.foundation.future.CancelledError" title="grpc.framework.foundation.future.CancelledError"><code class="xref py py-exc docutils literal"><span class="pre">CancelledError</span></code></a> – If the computation was cancelled.</li></ul></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.framework.foundation.future.Future.result"><code class="descname">result</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.result"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.result" title="Permalink to this definition">¶</a></dt><dd><p>Accesses the outcome of the computation or raises its exception.</p><p>This method may return immediately or may block.</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>timeout</strong> – The length of time in seconds to wait for the computation tofinish or be cancelled, or None if this method should block until thecomputation has finished or is cancelled no matter how long that takes.</p></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The return value of the computation.</p></td></tr><tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple"><li><a class="reference internal" href="#grpc.framework.foundation.future.TimeoutError" title="grpc.framework.foundation.future.TimeoutError"><code class="xref py py-exc docutils literal"><span class="pre">TimeoutError</span></code></a> – If a timeout value is passed and the computation does notterminate within the allotted time.</li><li><a class="reference internal" href="#grpc.framework.foundation.future.CancelledError" title="grpc.framework.foundation.future.CancelledError"><code class="xref py py-exc docutils literal"><span class="pre">CancelledError</span></code></a> – If the computation was cancelled.</li><li><code class="xref py py-exc docutils literal"><span class="pre">Exception</span></code> – If the computation raised an exception, this call will raisethe same exception.</li></ul></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.framework.foundation.future.Future.running"><code class="descname">running</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.running"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.running" title="Permalink to this definition">¶</a></dt><dd><p>Describes whether the computation is taking place.</p><p>This method does not block.</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">Returns:</th><td class="field-body"><dl class="docutils"><dt>True if the computation is scheduled to take place in the future or is</dt><dd>taking place now, or False if the computation took place in the past orwas cancelled.</dd></dl></td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.framework.foundation.future.Future.traceback"><code class="descname">traceback</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#Future.traceback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.Future.traceback" title="Permalink to this definition">¶</a></dt><dd><p>Access the traceback of the exception raised by the computation.</p><p>This method may return immediately or may block.</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>timeout</strong> – The length of time in seconds to wait for the computation toterminate or be cancelled, or None if this method should block untilthe computation is terminated or is cancelled no matter how long thattakes.</p></td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><dl class="docutils"><dt>The traceback of the exception raised by the computation, or None if the</dt><dd><p class="first last">computation did not raise an exception.</p></dd></dl></p></td></tr><tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple"><li><a class="reference internal" href="#grpc.framework.foundation.future.TimeoutError" title="grpc.framework.foundation.future.TimeoutError"><code class="xref py py-exc docutils literal"><span class="pre">TimeoutError</span></code></a> – If a timeout value is passed and the computation does notterminate within the allotted time.</li><li><a class="reference internal" href="#grpc.framework.foundation.future.CancelledError" title="grpc.framework.foundation.future.CancelledError"><code class="xref py py-exc docutils literal"><span class="pre">CancelledError</span></code></a> – If the computation was cancelled.</li></ul></td></tr></tbody></table></dd></dl></dd></dl><dl class="exception"><dt id="grpc.framework.foundation.future.TimeoutError"><em class="property">exception </em><code class="descclassname">grpc.framework.foundation.future.</code><code class="descname">TimeoutError</code><a class="reference internal" href="_modules/grpc/framework/foundation/future.html#TimeoutError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.future.TimeoutError" title="Permalink to this definition">¶</a></dt><dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></p><p>Indicates that a particular call timed out.</p></dd></dl></div><div class="section" id="module-grpc.framework.foundation.logging_pool"><span id="grpc-framework-foundation-logging-pool-module"></span><h2>grpc.framework.foundation.logging_pool module<a class="headerlink" href="#module-grpc.framework.foundation.logging_pool" title="Permalink to this headline">¶</a></h2><p>A thread pool that logs exceptions raised by tasks executed within it.</p><dl class="function"><dt id="grpc.framework.foundation.logging_pool.pool"><code class="descclassname">grpc.framework.foundation.logging_pool.</code><code class="descname">pool</code><span class="sig-paren">(</span><em>max_workers</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/logging_pool.html#pool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.logging_pool.pool" title="Permalink to this definition">¶</a></dt><dd><p>Creates a thread pool that logs exceptions raised by the tasks within it.</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"><strong>max_workers</strong> – The maximum number of worker threads to allow the pool.</td></tr><tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils"><dt>A futures.ThreadPoolExecutor-compatible thread pool that logs exceptions</dt><dd>raised by the tasks executed within it.</dd></dl></td></tr></tbody></table></dd></dl></div><div class="section" id="module-grpc.framework.foundation.stream"><span id="grpc-framework-foundation-stream-module"></span><h2>grpc.framework.foundation.stream module<a class="headerlink" href="#module-grpc.framework.foundation.stream" title="Permalink to this headline">¶</a></h2><p>Interfaces related to streams of values or objects.</p><dl class="class"><dt id="grpc.framework.foundation.stream.Consumer"><em class="property">class </em><code class="descclassname">grpc.framework.foundation.stream.</code><code class="descname">Consumer</code><a class="reference internal" href="_modules/grpc/framework/foundation/stream.html#Consumer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream.Consumer" title="Permalink to this definition">¶</a></dt><dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p><p>Interface for consumers of finite streams of values or objects.</p><dl class="method"><dt id="grpc.framework.foundation.stream.Consumer.consume"><code class="descname">consume</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream.html#Consumer.consume"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream.Consumer.consume" title="Permalink to this definition">¶</a></dt><dd><p>Accepts a value.</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"><strong>value</strong> – Any value accepted by this Consumer.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.framework.foundation.stream.Consumer.consume_and_terminate"><code class="descname">consume_and_terminate</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream.html#Consumer.consume_and_terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream.Consumer.consume_and_terminate" title="Permalink to this definition">¶</a></dt><dd><p>Supplies a value and signals that no more values will be supplied.</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"><strong>value</strong> – Any value accepted by this Consumer.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="grpc.framework.foundation.stream.Consumer.terminate"><code class="descname">terminate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream.html#Consumer.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream.Consumer.terminate" title="Permalink to this definition">¶</a></dt><dd><p>Indicates to this Consumer that no more values will be supplied.</p></dd></dl></dd></dl></div><div class="section" id="module-grpc.framework.foundation.stream_util"><span id="grpc-framework-foundation-stream-util-module"></span><h2>grpc.framework.foundation.stream_util module<a class="headerlink" href="#module-grpc.framework.foundation.stream_util" title="Permalink to this headline">¶</a></h2><p>Helpful utilities related to the stream module.</p><dl class="class"><dt id="grpc.framework.foundation.stream_util.IterableConsumer"><em class="property">class </em><code class="descclassname">grpc.framework.foundation.stream_util.</code><code class="descname">IterableConsumer</code><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#IterableConsumer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.IterableConsumer" title="Permalink to this definition">¶</a></dt><dd><p>Bases: <a class="reference internal" href="#grpc.framework.foundation.stream.Consumer" title="grpc.framework.foundation.stream.Consumer"><code class="xref py py-class docutils literal"><span class="pre">grpc.framework.foundation.stream.Consumer</span></code></a></p><p>A Consumer that when iterated over emits the values it has consumed.</p><dl class="method"><dt id="grpc.framework.foundation.stream_util.IterableConsumer.consume"><code class="descname">consume</code><span class="sig-paren">(</span><em>stock_reply</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#IterableConsumer.consume"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.IterableConsumer.consume" title="Permalink to this definition">¶</a></dt><dd></dd></dl><dl class="method"><dt id="grpc.framework.foundation.stream_util.IterableConsumer.consume_and_terminate"><code class="descname">consume_and_terminate</code><span class="sig-paren">(</span><em>stock_reply</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#IterableConsumer.consume_and_terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.IterableConsumer.consume_and_terminate" title="Permalink to this definition">¶</a></dt><dd></dd></dl><dl class="method"><dt id="grpc.framework.foundation.stream_util.IterableConsumer.next"><code class="descname">next</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#IterableConsumer.next"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.IterableConsumer.next" title="Permalink to this definition">¶</a></dt><dd></dd></dl><dl class="method"><dt id="grpc.framework.foundation.stream_util.IterableConsumer.terminate"><code class="descname">terminate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#IterableConsumer.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.IterableConsumer.terminate" title="Permalink to this definition">¶</a></dt><dd></dd></dl></dd></dl><dl class="class"><dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer"><em class="property">class </em><code class="descclassname">grpc.framework.foundation.stream_util.</code><code class="descname">ThreadSwitchingConsumer</code><span class="sig-paren">(</span><em>sink</em>, <em>pool</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#ThreadSwitchingConsumer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.ThreadSwitchingConsumer" title="Permalink to this definition">¶</a></dt><dd><p>Bases: <a class="reference internal" href="#grpc.framework.foundation.stream.Consumer" title="grpc.framework.foundation.stream.Consumer"><code class="xref py py-class docutils literal"><span class="pre">grpc.framework.foundation.stream.Consumer</span></code></a></p><p>A Consumer decorator that affords serialization and asynchrony.</p><dl class="method"><dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.consume"><code class="descname">consume</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#ThreadSwitchingConsumer.consume"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.consume" title="Permalink to this definition">¶</a></dt><dd></dd></dl><dl class="method"><dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.consume_and_terminate"><code class="descname">consume_and_terminate</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#ThreadSwitchingConsumer.consume_and_terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.consume_and_terminate" title="Permalink to this definition">¶</a></dt><dd></dd></dl><dl class="method"><dt id="grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.terminate"><code class="descname">terminate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#ThreadSwitchingConsumer.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.ThreadSwitchingConsumer.terminate" title="Permalink to this definition">¶</a></dt><dd></dd></dl></dd></dl><dl class="class"><dt id="grpc.framework.foundation.stream_util.TransformingConsumer"><em class="property">class </em><code class="descclassname">grpc.framework.foundation.stream_util.</code><code class="descname">TransformingConsumer</code><span class="sig-paren">(</span><em>transformation</em>, <em>downstream</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#TransformingConsumer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.TransformingConsumer" title="Permalink to this definition">¶</a></dt><dd><p>Bases: <a class="reference internal" href="#grpc.framework.foundation.stream.Consumer" title="grpc.framework.foundation.stream.Consumer"><code class="xref py py-class docutils literal"><span class="pre">grpc.framework.foundation.stream.Consumer</span></code></a></p><p>A stream.Consumer that passes a transformation of its input to another.</p><dl class="method"><dt id="grpc.framework.foundation.stream_util.TransformingConsumer.consume"><code class="descname">consume</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#TransformingConsumer.consume"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.TransformingConsumer.consume" title="Permalink to this definition">¶</a></dt><dd></dd></dl><dl class="method"><dt id="grpc.framework.foundation.stream_util.TransformingConsumer.consume_and_terminate"><code class="descname">consume_and_terminate</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#TransformingConsumer.consume_and_terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.TransformingConsumer.consume_and_terminate" title="Permalink to this definition">¶</a></dt><dd></dd></dl><dl class="method"><dt id="grpc.framework.foundation.stream_util.TransformingConsumer.terminate"><code class="descname">terminate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc/framework/foundation/stream_util.html#TransformingConsumer.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc.framework.foundation.stream_util.TransformingConsumer.terminate" title="Permalink to this definition">¶</a></dt><dd></dd></dl></dd></dl></div><div class="section" id="module-grpc.framework.foundation"><span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-grpc.framework.foundation" title="Permalink to this headline">¶</a></h2></div></div>           </div>           <div class="articleComments">                       </div>          </div>          <footer>      <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">              <a href="grpc.framework.interfaces.html" class="btn btn-neutral float-right" title="grpc.framework.interfaces package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>                    <a href="grpc.framework.common.html" class="btn btn-neutral" title="grpc.framework.common package" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>          </div>    <hr/>  <div role="contentinfo">    <p>        © Copyright 2016, The gRPC Authors.    </p>  </div>  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. </footer>        </div>      </div>    </section>  </div>        <script type="text/javascript">        var DOCUMENTATION_OPTIONS = {            URL_ROOT:'./',            VERSION:'1.2.0',            COLLAPSE_INDEX:false,            FILE_SUFFIX:'.html',            HAS_SOURCE:  true,            SOURCELINK_SUFFIX: '.txt'        };    </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>          <script type="text/javascript" src="_static/js/theme.js"></script>        <script type="text/javascript">      jQuery(function () {          SphinxRtdTheme.StickyNav.enable();      });  </script>   </body></html>
 |