Skip to content

Commit

Permalink
Promote NIMS package version and update Sphinx generated files in _docs
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Sep 19, 2023
1 parent 583003d commit 3eea1fd
Show file tree
Hide file tree
Showing 96 changed files with 1,655 additions and 889 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/.doctrees/autoapi/ni_measurementlink_service/index.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/.doctrees/environment.pickle
Binary file not shown.
3 changes: 2 additions & 1 deletion docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
ni_measurementlink_service
</a>
<div class="version">
1.2.0-dev1
1.2.0-dev2
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
Expand Down Expand Up @@ -73,6 +73,7 @@

<h1>All modules for which code is available</h1>
<ul><li><a href="google/_upb/_message.html">google._upb._message</a></li>
<li><a href="ni_measurementlink_service/_channelpool.html">ni_measurementlink_service._channelpool</a></li>
<li><a href="ni_measurementlink_service/_datatypeinfo.html">ni_measurementlink_service._datatypeinfo</a></li>
<li><a href="ni_measurementlink_service/_internal/discovery_client.html">ni_measurementlink_service._internal.discovery_client</a></li>
<li><a href="ni_measurementlink_service/_internal/grpc_servicer.html">ni_measurementlink_service._internal.grpc_servicer</a></li>
Expand Down
183 changes: 183 additions & 0 deletions docs/_modules/ni_measurementlink_service/_channelpool.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ni_measurementlink_service._channelpool &mdash; ni_measurementlink_service 1.2 documentation</title>
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->

<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/sphinx_highlight.js"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
</head>

<body class="wy-body-for-nav">
<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">
ni_measurementlink_service
</a>
<div class="version">
1.2.0-dev2
</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" aria-label="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="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../autoapi/index.html">API Reference</a></li>
</ul>

</div>
</div>
</nav>

<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../index.html">ni_measurementlink_service</a>
</nav>

<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="../index.html">Module code</a></li>
<li class="breadcrumb-item active">ni_measurementlink_service._channelpool</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">

<h1>Source code for ni_measurementlink_service._channelpool</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span>

<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">from</span> <span class="nn">threading</span> <span class="kn">import</span> <span class="n">Lock</span>
<span class="kn">from</span> <span class="nn">types</span> <span class="kn">import</span> <span class="n">TracebackType</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="p">(</span>
<span class="n">Dict</span><span class="p">,</span>
<span class="n">Literal</span><span class="p">,</span>
<span class="n">Optional</span><span class="p">,</span>
<span class="n">Type</span><span class="p">,</span>
<span class="n">TYPE_CHECKING</span><span class="p">,</span>
<span class="p">)</span>

<span class="kn">import</span> <span class="nn">grpc</span>

<span class="kn">from</span> <span class="nn">ni_measurementlink_service._loggers</span> <span class="kn">import</span> <span class="n">ClientLogger</span>

<span class="k">if</span> <span class="n">TYPE_CHECKING</span><span class="p">:</span>
<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">version_info</span> <span class="o">&gt;=</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">11</span><span class="p">):</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Self</span>
<span class="k">else</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">typing_extensions</span> <span class="kn">import</span> <span class="n">Self</span>


<div class="viewcode-block" id="GrpcChannelPool"><a class="viewcode-back" href="../../autoapi/ni_measurementlink_service/_channelpool/index.html#ni_measurementlink_service._channelpool.GrpcChannelPool">[docs]</a><span class="k">class</span> <span class="nc">GrpcChannelPool</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Class that manages gRPC channel lifetimes.&quot;&quot;&quot;</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Initialize the GrpcChannelPool object.&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_lock</span><span class="p">:</span> <span class="n">Lock</span> <span class="o">=</span> <span class="n">Lock</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_channel_cache</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">grpc</span><span class="o">.</span><span class="n">Channel</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span>

<div class="viewcode-block" id="GrpcChannelPool.__enter__"><a class="viewcode-back" href="../../autoapi/ni_measurementlink_service/_channelpool/index.html#ni_measurementlink_service._channelpool.GrpcChannelPool.__enter__">[docs]</a> <span class="k">def</span> <span class="fm">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Self</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Enter the runtime context of the GrpcChannelPool.&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span></div>

<div class="viewcode-block" id="GrpcChannelPool.__exit__"><a class="viewcode-back" href="../../autoapi/ni_measurementlink_service/_channelpool/index.html#ni_measurementlink_service._channelpool.GrpcChannelPool.__exit__">[docs]</a> <span class="k">def</span> <span class="fm">__exit__</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">exc_type</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Type</span><span class="p">[</span><span class="ne">BaseException</span><span class="p">]],</span>
<span class="n">exc_val</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="ne">BaseException</span><span class="p">],</span>
<span class="n">traceback</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">TracebackType</span><span class="p">],</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Literal</span><span class="p">[</span><span class="kc">False</span><span class="p">]:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Exit the runtime context of the GrpcChannelPool.&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">return</span> <span class="kc">False</span></div>

<div class="viewcode-block" id="GrpcChannelPool.get_channel"><a class="viewcode-back" href="../../autoapi/ni_measurementlink_service/_channelpool/index.html#ni_measurementlink_service._channelpool.GrpcChannelPool.get_channel">[docs]</a> <span class="k">def</span> <span class="nf">get_channel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">grpc</span><span class="o">.</span><span class="n">Channel</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Return a gRPC channel.</span>

<span class="sd"> Args:</span>
<span class="sd"> target (str): The server address</span>

<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">new_channel</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lock</span><span class="p">:</span>
<span class="k">if</span> <span class="n">target</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_channel_cache</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_lock</span><span class="o">.</span><span class="n">release</span><span class="p">()</span>
<span class="n">new_channel</span> <span class="o">=</span> <span class="n">grpc</span><span class="o">.</span><span class="n">insecure_channel</span><span class="p">(</span><span class="n">target</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ClientLogger</span><span class="o">.</span><span class="n">is_enabled</span><span class="p">():</span>
<span class="n">new_channel</span> <span class="o">=</span> <span class="n">grpc</span><span class="o">.</span><span class="n">intercept_channel</span><span class="p">(</span><span class="n">new_channel</span><span class="p">,</span> <span class="n">ClientLogger</span><span class="p">())</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_lock</span><span class="o">.</span><span class="n">acquire</span><span class="p">()</span>
<span class="k">if</span> <span class="n">target</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_channel_cache</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_channel_cache</span><span class="p">[</span><span class="n">target</span><span class="p">]</span> <span class="o">=</span> <span class="n">new_channel</span>
<span class="n">new_channel</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">channel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_channel_cache</span><span class="p">[</span><span class="n">target</span><span class="p">]</span>

<span class="c1"># Close new_channel if it was not stored in _channel_cache.</span>
<span class="k">if</span> <span class="n">new_channel</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">new_channel</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

<span class="k">return</span> <span class="n">channel</span></div>

<div class="viewcode-block" id="GrpcChannelPool.close"><a class="viewcode-back" href="../../autoapi/ni_measurementlink_service/_channelpool/index.html#ni_measurementlink_service._channelpool.GrpcChannelPool.close">[docs]</a> <span class="k">def</span> <span class="nf">close</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Close channels opened by get_channel().&quot;&quot;&quot;</span>
<span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lock</span><span class="p">:</span>
<span class="k">for</span> <span class="n">channel</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_channel_cache</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
<span class="n">channel</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_channel_cache</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span></div></div>
</pre></div>

</div>
</div>
<footer>

<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2023, National Instruments.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.


</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
ni_measurementlink_service
</a>
<div class="version">
1.2.0-dev1
1.2.0-dev2
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
ni_measurementlink_service
</a>
<div class="version">
1.2.0-dev1
1.2.0-dev2
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
Expand Down
Loading

0 comments on commit 3eea1fd

Please sign in to comment.