zerodb-rq
Python RQ-compatible task queue backed by ZeroDB. No Redis required -- auto-provisions on first use.
Why zerodb-rq?
| Python RQ | Celery | zerodb-rq | |
|---|---|---|---|
| Requires | Redis | Redis/RabbitMQ | Nothing |
| Setup | Install + configure Redis | Install + configure broker | pip install zerodb-rq |
| Persistence | Redis (volatile) | Configurable | ZeroDB (cloud, durable) |
| Auto-provisioning | No | No | Yes (free, no signup) |
Installation
pip install zerodb-rq
Quick Start
Enqueue Jobs
from zerodb_rq import Queue
def send_email(to, subject, body):
print(f"Sending email to {to}: {subject}")
q = Queue() # auto-provisions ZeroDB
job = q.enqueue(send_email, "alice@example.com", "Hello", body="Hi there")
print(f"Job {job.id} enqueued")
Run a Worker
from zerodb_rq import Queue, Worker
q = Queue()
w = Worker([q])
w.work() # Polls and executes jobs
Burst Mode (Run Once)
w = Worker([q])
w.work(burst=True) # Process all queued jobs, then stop
How It Works
Queue.enqueue()serializes the function call and stores it in a ZeroDB table (rq_jobs)Worker.work()polls the table for queued jobs, dequeues them FIFO, and executes- Results are stored in a separate ZeroDB table (
rq_results) - On first use, ZeroDB is auto-provisioned (free, no signup)
API Reference
Queue(name="default", api_key=None, project_id=None)
| Method | Description |
|---|---|
enqueue(func, *args, **kwargs) |
Add a job to the queue |
enqueue_call(func, args, kwargs) |
Add a job with explicit args |
count() |
Number of queued jobs |
is_empty |
Whether the queue is empty |
empty() |
Remove all queued jobs |
fetch_job(job_id) |
Get a specific job |
get_jobs() |
List all queued jobs |
dequeue() |
Pop the next job |
fetch_result(job_id) |
Get a completed job's result |
Worker(queues, poll_interval=1)
| Method | Description |
|---|---|
work(burst=False, max_jobs=None) |
Start processing jobs |
stop() |
Signal graceful shutdown |
is_running |
Whether the worker is active |
total_completed |
Jobs completed count |
total_failed |
Jobs failed count |
Job
| Attribute | Description |
|---|---|
id |
Unique job identifier |
func_name |
Dotted function path |
args |
Positional arguments |
kwargs |
Keyword arguments |
status |
queued / started / finished / failed |
result |
Return value (after execution) |
error |
Error message (if failed) |
Configuration
Explicit Credentials
q = Queue(api_key="your-api-key", project_id="your-project-id")
Environment Variables
export ZERODB_API_KEY="your-api-key"
export ZERODB_PROJECT_ID="your-project-id"
Credential Resolution Order
- Constructor arguments
- Environment variables (
ZERODB_API_KEY,ZERODB_PROJECT_ID) - Config file (
~/.zerodb/config.json) - Auto-provision (free, no signup)
Examples
Multiple Queues
high = Queue(name="high-priority")
low = Queue(name="low-priority")
high.enqueue(critical_task, data)
low.enqueue(background_task, data)
# Worker processes high-priority first
w = Worker([high, low])
w.work()
Custom Job ID
job = q.enqueue(process_order, order_id, job_id=f"order-{order_id}")
Job Results
job = q.enqueue(calculate, 42)
# ... later, after worker processes it ...
result = q.fetch_result(job.id)
License
MIT
Powered by ZeroDB + AINative
ZeroDB is a serverless database with auto-provisioning, vector search, and NoSQL tables. Build AI-native apps without managing infrastructure.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zerodb_rq-0.1.0.tar.gz
(12.4 kB
view details)
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
zerodb_rq-0.1.0-py3-none-any.whl
(10.4 kB
view details)
File details
Details for the file zerodb_rq-0.1.0.tar.gz.
File metadata
- Download URL: zerodb_rq-0.1.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35bb7be414618b622c78e002355e8ea8d32c3f1fd261e829b1ebd9e9cd419424
|
|
| MD5 |
772d78e418d5223d11e4a93d1848a922
|
|
| BLAKE2b-256 |
841452bf68950361e2461b4037fef68fd2990fd531a8a4308e7d7b0427b56f8a
|
File details
Details for the file zerodb_rq-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zerodb_rq-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb55865938126c9c9dbb727371157457eb9bcd84a5f8da3dc56a3095935b301c
|
|
| MD5 |
21d0ee9895c0b5ffa2c2f4c9143186ed
|
|
| BLAKE2b-256 |
0b9fd34c5d3e4a00e72fe53b432e2dc42458cede98d6f58f6037d00005f985d9
|