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, quesadilla
with examples: pip install quesadilla[examples]==0.4.0
.
tasks.py
:
import logging
import random
from quesadilla.connectors.in_memory import ThreadSafeInMemoryConnector
from quesadilla.core import 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
# simulate someone adding jobs to the queue
# queue is preloaded with 200 tasks
for _ in range(100):
simple_task.queue(random.choice((0, 1)))
simple_atask.queue(random.choice((0, 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.4.0.tar.gz
(14.9 kB
view hashes)
Built Distribution
quesadilla-0.4.0-py3-none-any.whl
(15.4 kB
view hashes)
Close
Hashes for quesadilla-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b83352db79c703cc3b7c7d1a1abccf5a1b1d575d91dbcc7af4c68cdd835d1fde |
|
MD5 | 56dc77297bd6f0633b068085efed91cf |
|
BLAKE2b-256 | 5f2ab7e636a7a933516b405a5b652242fcbfd5bf1312fec7571a201c9ab8add7 |