Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jul 17, 2024
1 parent b813954 commit 3a6d110
Show file tree
Hide file tree
Showing 85 changed files with 6,176 additions and 17 deletions.
2 changes: 1 addition & 1 deletion stable/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 041b978ad7dfbedc4d772508d4dd16cb
config: 99fc6aff81c34ee67384ad25a009edab
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified stable/.doctrees/commands/run.doctree
Binary file not shown.
Binary file modified stable/.doctrees/environment.pickle
Binary file not shown.
Binary file modified stable/.doctrees/methoddocs/application.doctree
Binary file not shown.
Binary file modified stable/.doctrees/methoddocs/exceptions.doctree
Binary file not shown.
Binary file modified stable/.doctrees/methoddocs/middlewares.doctree
Binary file not shown.
Binary file modified stable/.doctrees/methoddocs/runner.doctree
Binary file not shown.
Binary file modified stable/.doctrees/methoddocs/subscriptions.doctree
Binary file not shown.
Binary file modified stable/.doctrees/methoddocs/utils.doctree
Binary file not shown.
Binary file modified stable/.doctrees/userguides/development.doctree
Binary file not shown.
Binary file modified stable/.doctrees/userguides/quickstart.doctree
Binary file not shown.
18 changes: 15 additions & 3 deletions stable/_sources/userguides/development.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,32 @@ else:
# Log what the transaction *would* have done, had a signer been enabled
```

```note
```{note}
If you configure your application to use a signer, and that signer signs anything given to it, remember that you can lose substational amounts of funds if you deploy this to a production network.
Always test your applications throughly before deploying.
```

### Distributed Execution

Using only the `silverback run ...` command in a defualt configuration executes everything in one process and the job queue is completely in-memory with a shared state. In some high volume environments, you may want to deploy your Silverback application in a distributed configuration using multiple processes to handle the messages at a higher rate.
Using only the `silverback run ...` command in a default configuration executes everything in one process and the job queue is completely in-memory with a shared state.
In some high volume environments, you may want to deploy your Silverback application in a distributed configuration using multiple processes to handle the messages at a higher rate.

The primary components are the client and workers. The client handles Silverback events (blocks and contract event logs) and creates jobs for the workers to process in an asynchronous manner.

For this to work, you must configure a [TaskIQ broker](https://taskiq-python.github.io/guide/architecture-overview.html#broker) capable of distributed processing. For instance, with [`taskiq_redis`](https://github.com/taskiq-python/taskiq-redis) you could do something like this for the client:
For this to work, you must configure a [TaskIQ broker](https://taskiq-python.github.io/guide/architecture-overview.html#broker) capable of distributed processing.
Additonally, it is highly suggested you should also configure a [TaskIQ result backend](https://taskiq-python.github.io/guide/architecture-overview.html#result-backend) in order to process and store the results of executing tasks.

```{note}
Without configuring a result backend, Silverback may not work as expected since your tasks will now suddenly return `None` instead of the actual result.
```

For instance, with [`taskiq_redis`](https://github.com/taskiq-python/taskiq-redis) you could do something like this for the client:

```bash
export SILVERBACK_BROKER_CLASS="taskiq_redis:ListQueueBroker"
export SILVERBACK_BROKER_KWARGS='{"queue_name": "taskiq", "url": "redis://127.0.0.1:6379"}'
export SILVERBACK_RESULT_BACKEND_CLASS="taskiq_redis:RedisAsyncResultBackend"
export SILVERBACK_RESULT_BACKEND_URI="redis://127.0.0.1:6379"

silverback run "example:app" --network :mainnet:alchemy
```
Expand All @@ -166,6 +176,8 @@ And then the worker process with 2 worker subprocesses:
```bash
export SILVERBACK_BROKER_CLASS="taskiq_redis:ListQueueBroker"
export SILVERBACK_BROKER_KWARGS='{"url": "redis://127.0.0.1:6379"}'
export SILVERBACK_RESULT_BACKEND_CLASS="taskiq_redis:RedisAsyncResultBackend"
export SILVERBACK_RESULT_BACKEND_URI="redis://127.0.0.1:6379"

silverback worker -w 2 "example:app"
```
Expand Down
3 changes: 2 additions & 1 deletion stable/commands/run.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down Expand Up @@ -146,7 +147,7 @@ <h2>run<a class="headerlink" href="#run" title="Permalink to this heading"></
<dd><p>Override the default network and provider. (see <cite>ape networks list</cite> for options)</p>
<dl class="field-list simple">
<dt class="field-odd">Options<span class="colon">:</span></dt>
<dd class="field-odd"><p>:mainnet:geth | ethereum:mainnet:geth | :mainnet | ethereum:mainnet | :goerli:geth | ethereum:goerli:geth | :goerli | ethereum:goerli | :sepolia:geth | ethereum:sepolia:geth | :sepolia | ethereum:sepolia | ::geth | :local:geth | ethereum::geth | ethereum:local:geth | ::test | :local:test | ethereum::test | ethereum:local:test | :local | ethereum:local | ethereum</p>
<dd class="field-odd"><p>:mainnet:node | ethereum:mainnet:node | :mainnet | ethereum:mainnet | :sepolia:node | ethereum:sepolia:node | :sepolia | ethereum:sepolia | :holesky:node | ethereum:holesky:node | :holesky | ethereum:holesky | ::node | :local:node | ethereum::node | ethereum:local:node | ::test | :local:test | ethereum::test | ethereum:local:test | :local | ethereum:local | ethereum</p>
</dd>
</dl>
</dd></dl>
Expand Down
1 change: 1 addition & 0 deletions stable/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down
1 change: 1 addition & 0 deletions stable/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down
1 change: 1 addition & 0 deletions stable/methoddocs/application.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down
1 change: 1 addition & 0 deletions stable/methoddocs/exceptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down
1 change: 1 addition & 0 deletions stable/methoddocs/middlewares.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down
1 change: 1 addition & 0 deletions stable/methoddocs/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down
1 change: 1 addition & 0 deletions stable/methoddocs/subscriptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down
1 change: 1 addition & 0 deletions stable/methoddocs/utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down
1 change: 1 addition & 0 deletions stable/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down
1 change: 1 addition & 0 deletions stable/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down
2 changes: 1 addition & 1 deletion stable/searchindex.js

Large diffs are not rendered by default.

23 changes: 18 additions & 5 deletions stable/userguides/development.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<option value="">Select version...</option>
<option value="latest">latest</option>
<option value="stable">stable</option>
<option value="v0.5.2">v0.5.2</option>
<option value="v0.5.1">v0.5.1</option>
<option value="v0.5.0">v0.5.0</option>
<option value="v0.4.2">v0.4.2</option>
Expand Down Expand Up @@ -260,24 +261,36 @@ <h2>Running your Application<a class="headerlink" href="#running-your-applicatio
<span class="c1"># Log what the transaction *would* have done, had a signer been enabled</span>
</pre></div>
</div>
<div class="highlight-note notranslate"><div class="highlight"><pre><span></span>If you configure your application to use a signer, and that signer signs anything given to it, remember that you can lose substational amounts of funds if you deploy this to a production network.
Always test your applications throughly before deploying.
</pre></div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If you configure your application to use a signer, and that signer signs anything given to it, remember that you can lose substational amounts of funds if you deploy this to a production network.
Always test your applications throughly before deploying.</p>
</div>
<section id="distributed-execution">
<h3>Distributed Execution<a class="headerlink" href="#distributed-execution" title="Permalink to this heading"></a></h3>
<p>Using only the <code class="docutils literal notranslate"><span class="pre">silverback</span> <span class="pre">run</span> <span class="pre">...</span></code> command in a defualt configuration executes everything in one process and the job queue is completely in-memory with a shared state. In some high volume environments, you may want to deploy your Silverback application in a distributed configuration using multiple processes to handle the messages at a higher rate.</p>
<p>Using only the <code class="docutils literal notranslate"><span class="pre">silverback</span> <span class="pre">run</span> <span class="pre">...</span></code> command in a default configuration executes everything in one process and the job queue is completely in-memory with a shared state.
In some high volume environments, you may want to deploy your Silverback application in a distributed configuration using multiple processes to handle the messages at a higher rate.</p>
<p>The primary components are the client and workers. The client handles Silverback events (blocks and contract event logs) and creates jobs for the workers to process in an asynchronous manner.</p>
<p>For this to work, you must configure a <a class="reference external" href="https://taskiq-python.github.io/guide/architecture-overview.html#broker">TaskIQ broker</a> capable of distributed processing. For instance, with <a class="reference external" href="https://github.com/taskiq-python/taskiq-redis"><code class="docutils literal notranslate"><span class="pre">taskiq_redis</span></code></a> you could do something like this for the client:</p>
<p>For this to work, you must configure a <a class="reference external" href="https://taskiq-python.github.io/guide/architecture-overview.html#broker">TaskIQ broker</a> capable of distributed processing.
Additonally, it is highly suggested you should also configure a <a class="reference external" href="https://taskiq-python.github.io/guide/architecture-overview.html#result-backend">TaskIQ result backend</a> in order to process and store the results of executing tasks.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Without configuring a result backend, Silverback may not work as expected since your tasks will now suddenly return <code class="docutils literal notranslate"><span class="pre">None</span></code> instead of the actual result.</p>
</div>
<p>For instance, with <a class="reference external" href="https://github.com/taskiq-python/taskiq-redis"><code class="docutils literal notranslate"><span class="pre">taskiq_redis</span></code></a> you could do something like this for the client:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">export</span><span class="w"> </span><span class="nv">SILVERBACK_BROKER_CLASS</span><span class="o">=</span><span class="s2">&quot;taskiq_redis:ListQueueBroker&quot;</span>
<span class="nb">export</span><span class="w"> </span><span class="nv">SILVERBACK_BROKER_KWARGS</span><span class="o">=</span><span class="s1">&#39;{&quot;queue_name&quot;: &quot;taskiq&quot;, &quot;url&quot;: &quot;redis://127.0.0.1:6379&quot;}&#39;</span>
<span class="nb">export</span><span class="w"> </span><span class="nv">SILVERBACK_RESULT_BACKEND_CLASS</span><span class="o">=</span><span class="s2">&quot;taskiq_redis:RedisAsyncResultBackend&quot;</span>
<span class="nb">export</span><span class="w"> </span><span class="nv">SILVERBACK_RESULT_BACKEND_URI</span><span class="o">=</span><span class="s2">&quot;redis://127.0.0.1:6379&quot;</span>

silverback<span class="w"> </span>run<span class="w"> </span><span class="s2">&quot;example:app&quot;</span><span class="w"> </span>--network<span class="w"> </span>:mainnet:alchemy
</pre></div>
</div>
<p>And then the worker process with 2 worker subprocesses:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">export</span><span class="w"> </span><span class="nv">SILVERBACK_BROKER_CLASS</span><span class="o">=</span><span class="s2">&quot;taskiq_redis:ListQueueBroker&quot;</span>
<span class="nb">export</span><span class="w"> </span><span class="nv">SILVERBACK_BROKER_KWARGS</span><span class="o">=</span><span class="s1">&#39;{&quot;url&quot;: &quot;redis://127.0.0.1:6379&quot;}&#39;</span>
<span class="nb">export</span><span class="w"> </span><span class="nv">SILVERBACK_RESULT_BACKEND_CLASS</span><span class="o">=</span><span class="s2">&quot;taskiq_redis:RedisAsyncResultBackend&quot;</span>
<span class="nb">export</span><span class="w"> </span><span class="nv">SILVERBACK_RESULT_BACKEND_URI</span><span class="o">=</span><span class="s2">&quot;redis://127.0.0.1:6379&quot;</span>

silverback<span class="w"> </span>worker<span class="w"> </span>-w<span class="w"> </span><span class="m">2</span><span class="w"> </span><span class="s2">&quot;example:app&quot;</span>
</pre></div>
Expand Down
Loading

0 comments on commit 3a6d110

Please sign in to comment.