An elegant background task queue for the more civilized age
Project description
quesadilla
quesadilla
is an elegant background task queue for the more civilized age.
Example usage
First, install the basic metapackage: pip install quesadilla==0.3.0
.
tasks.py
:
import logging
from quesadilla.connectors.in_memory import ThreadSafeInMemoryConnector
from quesadilla.shortcuts import QueuedTask, TaskNamespace, async_task, sync_task
logging.basicConfig(level=logging.INFO)
namespace = TaskNamespace("tasks", connector=ThreadSafeInMemoryConnector())
queue = namespace.new("queue")
@sync_task(queue)
def simple_task(i: int) -> bool:
return i == 0
@async_task(queue)
async def simple_atask(i: int) -> bool:
return i == 0
tasks: list[QueuedTask[[int], bool]] = []
# queue is preloaded with 200 tasks
for _ in range(100):
tasks.append(simple_task.queue(0))
tasks.append(simple_atask.queue(1))
Run with python -m quesadilla runners listener tasks::queue
.
Exit with SIGINT
(Ctrl + C) or SIGTERM
.
Roadmap
- support for retrying failed tasks
- support for cronjobs and heartbeat
- support for task priority
- support for delayed execution
- documentation
- sync and async connectors split (probably)
- a real-world connector! (most likely PostgreSQL with
psycopg
andSQLAlchemy 2.0
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
quesadilla-0.3.0.tar.gz
(16.1 kB
view hashes)
Built Distribution
quesadilla-0.3.0-py3-none-any.whl
(19.8 kB
view hashes)
Close
Hashes for quesadilla-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf46f4cbeab7d7afa5293b74c720c39ee9e583c59eadc2929dd28abb0a0b6cd5 |
|
MD5 | dec7aaf1a2d8145d2a7fa9e6586d94bc |
|
BLAKE2b-256 | 8a761b8213f3587a62f2ddbde46c235d7eec7cb227d4bd8a790582db26aeb84a |