Skip to content

Commit

Permalink
Deploying to gh-pages from @ 20807bc 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
isra17 committed May 5, 2023
1 parent 5c2386c commit bd7ee47
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
20 changes: 20 additions & 0 deletions _sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,26 @@ in the task processing this value can be overridden.
abort(message_id, abort_ttl=2*60*60*1000)
Abort a task running a subprocess
---------------------------------
When a worker is waiting on a subprocess, the :any:`Abort` exception will only be raised
AFTER the subprocess has been completed. The following example is one way to deal with this:

.. code-block::
@dramatiq.actor
def my_subprocess():
with subprocess.Popen(*args, **kwargs) as process:
ret = None
try:
while ret is None:
try:
ret = process.wait(timeout=1) # Note: same principle for `process.communicate()`
except subprocess.TimeoutExpired:
pass
except Abort:
process.signal(signal.SIGINT) # or on windows: `os.kill(process.pid, signal.SIGINT)`
process.wait()
API
---

Expand Down
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ <h2>Abort a task using a custom abort_ttl value<a class="headerlink" href="#abor
</pre></div>
</div>
</section>
<section id="abort-a-task-running-a-subprocess">
<h2>Abort a task running a subprocess<a class="headerlink" href="#abort-a-task-running-a-subprocess" title="Permalink to this heading"></a></h2>
<p>When a worker is waiting on a subprocess, the <a class="reference internal" href="#dramatiq_abort.Abort" title="dramatiq_abort.Abort"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Abort</span></code></a> exception will only be raised
AFTER the subprocess has been completed. The following example is one way to deal with this:</p>
</section>
<section id="module-dramatiq_abort">
<span id="api"></span><h2>API<a class="headerlink" href="#module-dramatiq_abort" title="Permalink to this heading"></a></h2>
<dl class="py function">
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bd7ee47

Please sign in to comment.