Skip to content

Commit

Permalink
docs: Updating?
Browse files Browse the repository at this point in the history
Signed-off-by: Courtney Caldwell <courtneyccaldwell@gmail.com>
  • Loading branch information
prokopto-dev committed May 22, 2024
1 parent b58cb70 commit b3b913d
Show file tree
Hide file tree
Showing 18 changed files with 493 additions and 5 deletions.
Binary file modified docs/.doctrees/api/client.doctree
Binary file not shown.
Binary file added docs/.doctrees/contributing.doctree
Binary file not shown.
Binary file modified docs/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/.doctrees/index.doctree
Binary file not shown.
Binary file added docs/.doctrees/parallelism.doctree
Binary file not shown.
5 changes: 5 additions & 0 deletions docs/_sources/contributing.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
=================
How To Contribute
=================

While we welcome contributions, we ask that you please follow the guidelines below:
24 changes: 24 additions & 0 deletions docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ What is Fabric-Plus?

Fabric-Plus is a wrapper around several Fabric sourced objects to provide new functionality not currently a part of the main Fabric library. This includes:

.. _getting_started:

Getting Started
---------------

Expand All @@ -20,6 +22,28 @@ Getting Started

getting-started

.. _contributing:

Concurrency
-----------

If you'd like a little information on how to run Connections in parallel, here's a small doc with some notes.

.. toctree::
:maxdepth: 2

parallelism

Contributing
------------

Interested in contributing to Fabric-Plus? Great! We have a guide for that!

.. toctree::
:maxdepth: 2

contributing

.. _api-docs:

API
Expand Down
84 changes: 84 additions & 0 deletions docs/_sources/parallelism.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
===============================
Running Connections In Parallel
===============================

It is possible to run multiple connections at the same time, and have them handled in a multi-threaded or multi-processing library.

Testing is generally done using the ``concurrent.futures`` library, which is a high-level interface for asynchronously executing functions in a separate thread or process.

The advantage of using ``concurrent.futures`` is that it behaves similar to the way the ``Connection`` object expects to be used, in that it runs in the hopes it works, and resolves errors after rather than interactively.

Creating a bunch of connections
-------------------------------

Here's an example of how one might use ``concurrent.futures`` to run multiple connections at the same time.

.. code-block:: python3
import concurrent.futures
from fabricplus.connection import ConnectionPlus as Connection
from traceback import format_exc
# Create a list of hosts
hosts: list[str] = [
"host1",
"host2",
"host3",
"host4",
"host5",
"host6",
"host7",
"host8",
"host9",
"host10",
]
connections: list[Connection] = []
# Create a list of connections, concurrently
with concurrent.futures.ThreadPoolExecutor() as executor:
futures = [executor.submit(Connection, host) for host in hosts]
tb: Optional[str] = None
# the code below helps handle tracebacks and errors;
# with out it, silent failures may occur
for future in concurrent.futures.as_completed(futures):
try:
tb = None
connections.append(future.result())
except Exception as e:
tb = traceback.format_exc()
finally:
if tb:
print(f"Error: {tb}")
# Now you can use the connections, presuming they worked
with concurrent.futures.ThreadPoolExecutor() as executor:
futures = [executor.submit(connection.run, "ls -l") for connection in connections]
tb: Optional[str] = None
for future in concurrent.futures.as_completed(futures):
try:
tb = None
print(future.result())
except Exception as e:
tb = traceback.format_exc()
finally:
if tb:
print(f"Error: {tb}")
Important Note on ``SU`` In Parallelism
---------------------------------------

The ``SU`` command is a special command that is used to switch users.

It is one of the features I built this library for, and it generally works great.

However, on some hosts, the ``SU`` command does NOT work in a non-interactive shell.

This is because of some complex kernel behaviors in older versions to avoid a security vulnerability.

Personally, I have found that ``CentOS 7`` and older, as well as simmilar versions of ``RHEL`` and ``Fedora`` have all had the same issue.

The same may be true for other distributions, but I have found that ``Debian`` and ``Ubuntu`` have not had this issue.

If you are using a host that has this issue, you will need to use the ``sudo`` command to switch users.
12 changes: 9 additions & 3 deletions docs/api/client.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="connection" href="connection.html" />
<link rel="prev" title="Getting Started" href="../getting-started.html" />
<link rel="prev" title="How To Contribute" href="../contributing.html" />

<link rel="stylesheet" href="../_static/custom.css" type="text/css" />

Expand Down Expand Up @@ -162,7 +162,7 @@ <h2>Example<a class="headerlink" href="#example" title="Link to this heading">¶
</ul>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>ValueError</strong> – If jump_session and sock are both provided as arguments;
<dd class="field-even"><p><strong>ValueError</strong> – If jump_session and sock are both provided as arguments;
they are mutually exclusive</p>
</dd>
<dt class="field-odd">Returns<span class="colon">:</span></dt>
Expand Down Expand Up @@ -279,6 +279,12 @@ <h3>Navigation</h3>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../getting-started.html">Getting Started</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../parallelism.html">Running Connections In Parallel</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../contributing.html">How To Contribute</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">paramiko_modifications.client</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="connection.html"><code class="docutils literal notranslate"><span class="pre">connection</span></code></a></li>
Expand All @@ -289,7 +295,7 @@ <h3>Navigation</h3>
<h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
<li>Previous: <a href="../getting-started.html" title="previous chapter">Getting Started</a></li>
<li>Previous: <a href="../contributing.html" title="previous chapter">How To Contribute</a></li>
<li>Next: <a href="connection.html" title="next chapter"><code class="docutils literal notranslate"><span class="pre">connection</span></code></a></li>
</ul></li>
</ul>
Expand Down
6 changes: 6 additions & 0 deletions docs/api/connection.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ <h3>Navigation</h3>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../getting-started.html">Getting Started</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../parallelism.html">Running Connections In Parallel</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../contributing.html">How To Contribute</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="client.html"><code class="docutils literal notranslate"><span class="pre">paramiko_modifications.client</span></code></a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">connection</span></code></a></li>
Expand Down
123 changes: 123 additions & 0 deletions docs/contributing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<!DOCTYPE html>

<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<title>How To Contribute &#8212; Fabric-Plus 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=12dfc556" />
<script src="_static/documentation_options.js?v=2709fde1"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="canonical" href="https://fabricplus.prokopto.dev/contributing.html" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="paramiko_modifications.client" href="api/client.html" />
<link rel="prev" title="Running Connections In Parallel" href="parallelism.html" />

<link rel="stylesheet" href="_static/custom.css" type="text/css" />





</head><body>


<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">


<div class="body" role="main">

<section id="how-to-contribute">
<h1>How To Contribute<a class="headerlink" href="#how-to-contribute" title="Link to this heading"></a></h1>
<p>While we welcome contributions, we ask that you please follow the guidelines below:</p>
</section>


</div>

</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/logo.png" alt="Logo"/>
</a></p>
<h1 class="logo"><a href="index.html">Fabric-Plus</a></h1>








<h3>Navigation</h3>
<ul>
<li class="toctree-l1"><a class="reference internal" href="getting-started.html">Getting Started</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="parallelism.html">Running Connections In Parallel</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">How To Contribute</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="api/client.html"><code class="docutils literal notranslate"><span class="pre">paramiko_modifications.client</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="api/connection.html"><code class="docutils literal notranslate"><span class="pre">connection</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="api/transfer.html"><code class="docutils literal notranslate"><span class="pre">transfer</span></code></a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="parallelism.html" title="previous chapter">Running Connections In Parallel</a></li>
<li>Next: <a href="api/client.html" title="next chapter"><code class="docutils literal notranslate"><span class="pre">paramiko_modifications.client</span></code></a></li>
</ul></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>








</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&#169;2024, Courtney Caldwell.

|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>

|
<a href="_sources/contributing.rst.txt"
rel="nofollow">Page source</a>
</div>




</body>
</html>
6 changes: 6 additions & 0 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ <h3>Navigation</h3>
<li class="toctree-l1"><a class="reference internal" href="getting-started.html">Getting Started</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="parallelism.html">Running Connections In Parallel</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="contributing.html">How To Contribute</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="api/client.html"><code class="docutils literal notranslate"><span class="pre">paramiko_modifications.client</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="api/connection.html"><code class="docutils literal notranslate"><span class="pre">connection</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="api/transfer.html"><code class="docutils literal notranslate"><span class="pre">transfer</span></code></a></li>
Expand Down
30 changes: 29 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h2>What is Fabric-Plus?<a class="headerlink" href="#what-is-fabric-plus" title=
<p>Fabric-Plus is a wrapper around several Fabric sourced objects to provide new functionality not currently a part of the main Fabric library. This includes:</p>
</section>
<section id="getting-started">
<h2>Getting Started<a class="headerlink" href="#getting-started" title="Link to this heading"></a></h2>
<span id="id1"></span><h2>Getting Started<a class="headerlink" href="#getting-started" title="Link to this heading"></a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="getting-started.html">Getting Started</a><ul>
Expand All @@ -52,6 +52,28 @@ <h2>Getting Started<a class="headerlink" href="#getting-started" title="Link to
</ul>
</div>
</section>
<section id="concurrency">
<span id="contributing"></span><h2>Concurrency<a class="headerlink" href="#concurrency" title="Link to this heading"></a></h2>
<p>If you’d like a little information on how to run Connections in parallel, here’s a small doc with some notes.</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="parallelism.html">Running Connections In Parallel</a><ul>
<li class="toctree-l2"><a class="reference internal" href="parallelism.html#creating-a-bunch-of-connections">Creating a bunch of connections</a></li>
<li class="toctree-l2"><a class="reference internal" href="parallelism.html#important-note-on-su-in-parallelism">Important Note on <code class="docutils literal notranslate"><span class="pre">SU</span></code> In Parallelism</a></li>
</ul>
</li>
</ul>
</div>
</section>
<section id="id2">
<h2>Contributing<a class="headerlink" href="#id2" title="Link to this heading"></a></h2>
<p>Interested in contributing to Fabric-Plus? Great! We have a guide for that!</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="contributing.html">How To Contribute</a></li>
</ul>
</div>
</section>
<section id="api">
<span id="api-docs"></span><h2>API<a class="headerlink" href="#api" title="Link to this heading"></a></h2>
<p>Just here to figure out how the API works?</p>
Expand Down Expand Up @@ -97,6 +119,12 @@ <h3>Navigation</h3>
<li class="toctree-l1"><a class="reference internal" href="getting-started.html">Getting Started</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="parallelism.html">Running Connections In Parallel</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="contributing.html">How To Contribute</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="api/client.html"><code class="docutils literal notranslate"><span class="pre">paramiko_modifications.client</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="api/connection.html"><code class="docutils literal notranslate"><span class="pre">connection</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="api/transfer.html"><code class="docutils literal notranslate"><span class="pre">transfer</span></code></a></li>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
Loading

0 comments on commit b3b913d

Please sign in to comment.