Python background queues with an async twist
Project description
Python background queues with an async twist
Use async functions to manage complex background task workflows, and keep using synchronous functions for everything else.
Getting Started
Install queueio:
pip install queueio
Create your routines:
# basic.py
from time import sleep
from queueio import gather
from queueio import pause
from queueio import routine
@routine(name="blocking", queue="queueio")
def blocking():
sleep(0.1) # Regular blocking call
@routine(name="yielding", queue="queueio")
async def yielding(iterations: int):
# Do them two at a time
for _ in range(iterations // 2):
await gather(blocking(), blocking())
await pause(0.2) # Release processing capacity
if iterations % 2 == 1:
await blocking()
Add the configuration to your pyproject.toml:
[tool.queueio]
# Configure RabbitMQ
pika = "amqp://guest:guest@localhost:5672/"
# Register the modules that the worker should load to find your routines
register = ["basic"]
The pika configuration can be overridden with an environment variable to allow a project to be deployed in multiple environments.
QUEUEIO_PIKA='amqp://guest:guest@localhost:5672/'
Sync the queues to the broker:
queueio sync
Submit the routine to run on a worker:
from queueio import activate
from basic import yielding
with activate():
yielding(7).submit()
Then run the worker to process submitted routines:
queueio run queueio=4
Monitor the status of active routine invocations:
queueio monitor
Stability
The design of the public API is under active development and is likely to change with any release. Release notes will provide upgrade instructions, but backward compatibility and deprecation warnings will not generally be implemented.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file queueio-0.2.0.tar.gz.
File metadata
- Download URL: queueio-0.2.0.tar.gz
- Upload date:
- Size: 37.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
922e8ca8b37228f9179df06ae6b9a3ec412d3789cae18dc3d749fd8f048d060f
|
|
| MD5 |
9a2dfcd22f98590e27b88c8697ef7ea8
|
|
| BLAKE2b-256 |
00a5da0d0fb859291fdbab6424772e953567bc63cbd4c775d15073311cbb874b
|
Provenance
The following attestation bundles were made for queueio-0.2.0.tar.gz:
Publisher:
publish.yml on ryanhiebert/queueio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
queueio-0.2.0.tar.gz -
Subject digest:
922e8ca8b37228f9179df06ae6b9a3ec412d3789cae18dc3d749fd8f048d060f - Sigstore transparency entry: 716455920
- Sigstore integration time:
-
Permalink:
ryanhiebert/queueio@038ed63c370ac5dcf11782a232ec063ce015bc2b -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/ryanhiebert
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@038ed63c370ac5dcf11782a232ec063ce015bc2b -
Trigger Event:
release
-
Statement type:
File details
Details for the file queueio-0.2.0-py3-none-any.whl.
File metadata
- Download URL: queueio-0.2.0-py3-none-any.whl
- Upload date:
- Size: 48.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51a78cc2f31a4d3735d7981ee94d93b43363760b158b0b29a42f1aa57d25ea32
|
|
| MD5 |
113d0ec803c9a31c8c9dc7734cea1ba5
|
|
| BLAKE2b-256 |
f67b2a319122eed5e6f4ebe8473965a3cdca076edb14b8e1fe6fbbc73cc0dbbb
|
Provenance
The following attestation bundles were made for queueio-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on ryanhiebert/queueio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
queueio-0.2.0-py3-none-any.whl -
Subject digest:
51a78cc2f31a4d3735d7981ee94d93b43363760b158b0b29a42f1aa57d25ea32 - Sigstore transparency entry: 716455926
- Sigstore integration time:
-
Permalink:
ryanhiebert/queueio@038ed63c370ac5dcf11782a232ec063ce015bc2b -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/ryanhiebert
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@038ed63c370ac5dcf11782a232ec063ce015bc2b -
Trigger Event:
release
-
Statement type: