Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 24, 2024
1 parent a603955 commit 5251e93
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 14 deletions.
Binary file modified latest/.doctrees/commands/run.doctree
Binary file not shown.
Binary file modified latest/.doctrees/environment.pickle
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/exceptions.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/main.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/middlewares.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/runner.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/subscriptions.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/utils.doctree
Binary file not shown.
Binary file modified latest/.doctrees/userguides/deploying.doctree
Binary file not shown.
Binary file modified latest/.doctrees/userguides/development.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion latest/_sources/userguides/deploying.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ docker push your-registry-url/project/botA:latest

TODO: The ApeWorX team has github actions definitions for building, pushing and deploying.

If you are unfamiliar with docker and container registries, you can use the \[\[github-action\]\].
If you are unfamiliar with docker and container registries, you can use the \[[github-action]\].

You do not need to build using this command if you use the github action, but it is there to help you if you are having problems figuring out how to build and run your bot images on the cluster successfully.

Expand Down
10 changes: 5 additions & 5 deletions latest/_sources/userguides/development.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ def handle_on_worker_shutdown(state):

This function comes a parameter `state` that you can use for storing the results of your startup computation or resources that you have provisioned.

It's import to note that this is useful for ensuring that your workers (of which there can be multiple) have the resources necessary to properly handle any updates you want to make in your handler functions, such as connecting to the Telegram API, an SQL or NoSQL database connection, or something else. **This function will run on every worker process**.
It's import to note that this is useful for ensuring that your workers (of which there can be multiple) have the resources necessary to properly handle any updates you want to make in your handler functions, such as connecting to the Telegram API, an SQL or NoSQL database connection, or something else. **This function will run on every worker process**.

*New in 0.2.0*: These events moved from `on_startup()` and `on_shutdown()` for clarity.

#### Worker State

The `state` variable is also useful as this can be made available to each handler method so other stateful quantities can be maintained for other uses. Each distributed worker has its own instance of state.
The `state` variable is also useful as this can be made available to each handler method so other stateful quantities can be maintained for other uses. Each distributed worker has its own instance of state.

To access the state from a handler, you must annotate `context` as a dependency like so:

Expand All @@ -163,7 +163,7 @@ def block_handler(block, context: Annotated[Context, TaskiqDepends()]):

### Bot Events

You can also add an bot startup and shutdown handler that will be **executed once upon every bot startup**. This may be useful for things like processing historical events since the bot was shutdown or other one-time actions to perform at startup.
You can also add an bot startup and shutdown handler that will be **executed once upon every bot startup**. This may be useful for things like processing historical events since the bot was shutdown or other one-time actions to perform at startup.

```py
@bot.on_startup()
Expand All @@ -180,7 +180,7 @@ def handle_on_shutdown():
...
```

*Changed in 0.2.0*: The behavior of the `@bot.on_startup()` decorator and handler signature have changed. It is now executed only once upon bot startup and worker events have moved on `@bot.on_worker_startup()`.
*Changed in 0.2.0*: The behavior of the `@bot.on_startup()` decorator and handler signature have changed. It is now executed only once upon bot startup and worker events have moved on `@bot.on_worker_startup()`.

## Bot State

Expand Down Expand Up @@ -271,7 +271,7 @@ Use segregated keys and limit your risk by controlling the amount of funds that
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 bot 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.
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.
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.
Expand Down
4 changes: 2 additions & 2 deletions latest/commands/run.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h2>silverback run<a class="headerlink" href="#silverback-run" title="Link to th
<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: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 class="field-odd"><p>:goerli:node | ethereum:goerli:node | :goerli | ethereum:goerli | :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 Expand Up @@ -196,7 +196,7 @@ <h2>silverback worker<a class="headerlink" href="#silverback-worker" title="Link
<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: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 class="field-odd"><p>:goerli:node | ethereum:goerli:node | :goerli | ethereum:goerli | :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
2 changes: 1 addition & 1 deletion latest/searchindex.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions latest/userguides/development.html
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ <h3>Worker Events<a class="headerlink" href="#worker-events" title="Link to this
</span></pre></div>
</div>
<p>This function comes a parameter <code class="docutils literal notranslate"><span class="pre">state</span></code> that you can use for storing the results of your startup computation or resources that you have provisioned.</p>
<p>It’s import to note that this is useful for ensuring that your workers (of which there can be multiple) have the resources necessary to properly handle any updates you want to make in your handler functions, such as connecting to the Telegram API, an SQL or NoSQL database connection, or something else. <strong>This function will run on every worker process</strong>.</p>
<p>It’s import to note that this is useful for ensuring that your workers (of which there can be multiple) have the resources necessary to properly handle any updates you want to make in your handler functions, such as connecting to the Telegram API, an SQL or NoSQL database connection, or something else. <strong>This function will run on every worker process</strong>.</p>
<p><em>New in 0.2.0</em>: These events moved from <code class="docutils literal notranslate"><span class="pre">on_startup()</span></code> and <code class="docutils literal notranslate"><span class="pre">on_shutdown()</span></code> for clarity.</p>
<section id="worker-state">
<h4>Worker State<a class="headerlink" href="#worker-state" title="Link to this heading"></a></h4>
<p>The <code class="docutils literal notranslate"><span class="pre">state</span></code> variable is also useful as this can be made available to each handler method so other stateful quantities can be maintained for other uses. Each distributed worker has its own instance of state.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">state</span></code> variable is also useful as this can be made available to each handler method so other stateful quantities can be maintained for other uses. Each distributed worker has its own instance of state.</p>
<p>To access the state from a handler, you must annotate <code class="docutils literal notranslate"><span class="pre">context</span></code> as a dependency like so:</p>
<div class="highlight-py notranslate"><div class="highlight"><pre><span></span><span data-line="1"><span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Annotated</span>
</span><span data-line="2"><span class="kn">from</span> <span class="nn">taskiq</span> <span class="kn">import</span> <span class="n">Context</span><span class="p">,</span> <span class="n">TaskiqDepends</span>
Expand All @@ -277,7 +277,7 @@ <h4>Worker State<a class="headerlink" href="#worker-state" title="Link to this h
</section>
<section id="bot-events">
<h3>Bot Events<a class="headerlink" href="#bot-events" title="Link to this heading"></a></h3>
<p>You can also add an bot startup and shutdown handler that will be <strong>executed once upon every bot startup</strong>. This may be useful for things like processing historical events since the bot was shutdown or other one-time actions to perform at startup.</p>
<p>You can also add an bot startup and shutdown handler that will be <strong>executed once upon every bot startup</strong>. This may be useful for things like processing historical events since the bot was shutdown or other one-time actions to perform at startup.</p>
<div class="highlight-py notranslate"><div class="highlight"><pre><span></span><span data-line="1"><span class="nd">@bot</span><span class="o">.</span><span class="n">on_startup</span><span class="p">()</span>
</span><span data-line="2"><span class="k">def</span> <span class="nf">handle_on_startup</span><span class="p">(</span><span class="n">startup_state</span><span class="p">):</span>
</span><span data-line="3"> <span class="c1"># Process missed events, etc</span>
Expand All @@ -292,7 +292,7 @@ <h3>Bot Events<a class="headerlink" href="#bot-events" title="Link to this headi
</span><span data-line="12"> <span class="o">...</span>
</span></pre></div>
</div>
<p><em>Changed in 0.2.0</em>: The behavior of the <code class="docutils literal notranslate"><span class="pre">&#64;bot.on_startup()</span></code> decorator and handler signature have changed. It is now executed only once upon bot startup and worker events have moved on <code class="docutils literal notranslate"><span class="pre">&#64;bot.on_worker_startup()</span></code>.</p>
<p><em>Changed in 0.2.0</em>: The behavior of the <code class="docutils literal notranslate"><span class="pre">&#64;bot.on_startup()</span></code> decorator and handler signature have changed. It is now executed only once upon bot startup and worker events have moved on <code class="docutils literal notranslate"><span class="pre">&#64;bot.on_worker_startup()</span></code>.</p>
</section>
</section>
<section id="bot-state">
Expand Down Expand Up @@ -377,7 +377,7 @@ <h2>Running your Bot<a class="headerlink" href="#running-your-bot" title="Link t
<h3>Distributed Execution<a class="headerlink" href="#distributed-execution" title="Link 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 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 bot 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>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.
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">
Expand Down

0 comments on commit 5251e93

Please sign in to comment.