Skip to main content

A fast distributed task queue with a Rust core and a Python API, backed by Redis streams.

Project description

ArdiQ

A fast distributed task queue with a Rust core and a clean Python API, backed by Redis streams.

ArdiQ runs the worker loop and all Redis I/O in Rust (via PyO3 + tokio); you write tasks in plain Python. The two meet at a single async callback, with the GIL held only for the microseconds it takes to start a task and read its result — so a single process handles high concurrency.

Early stage. The engine is solid — priorities, retries with backoff, delayed/scheduled tasks, crash recovery, result storage — but the ergonomics layer is still growing.

Features

  • 🦀 Rust core — the loop and Redis I/O run on tokio, off the GIL
  • Priority queues — higher-priority tasks are consumed first
  • Delayed & scheduled tasks (delay_ms / schedule_ms)
  • Automatic retries with quadratic backoff, configurable per task
  • Crash recovery — in-flight tasks of a dead worker are reclaimed (XAUTOCLAIM)
  • Results with TTL, plus task status (queued / running / complete / not_found)
  • Sync & async tasks — blocking sync functions run in a thread pool
  • CLI worker (ardiq run module:app) and burst mode (drain the queue and exit)

Installation

ArdiQ isn't on PyPI yet. Build it from source — you'll need Rust and uv:

$ git clone https://github.com/17tayyy/ardiq
$ cd ardiq
$ uv sync            # builds the Rust extension and installs dependencies

You also need a Redis server. For local development:

$ docker compose up -d

Quickstart

Define an app and some tasks (example.py):

from ardiq import Ardiq

app = Ardiq(redis_url="redis://localhost:6379", queue_name="example")


@app.task()
async def add(a: int, b: int) -> int:
    return a + b


@app.task(max_retries=3)
def slow_double(x: int) -> int:   # sync task — runs in a thread
    return x * 2

Start a worker:

$ ardiq run example:app

Enqueue tasks from anywhere and read their results:

import asyncio
from example import add


async def main():
    job = await add.enqueue(2, 3)        # returns a Job handle
    print(job.id)
    print(await job.status())            # 'queued' | 'running' | 'complete'
    print(await job.result(timeout=5))   # waits → TaskResult(success=True, value=5, tries=1)


asyncio.run(main())

Or run the whole thing in one process with python example.py, which enqueues a few tasks and processes them in burst mode.

Configuration

Ardiq(...) accepts:

Option Default Description
redis_url redis://localhost:6379 Redis connection URL
queue_name "default" Logical queue (key namespace)
priorities ["default"] Priority names, lowest-first
concurrency 16 Max tasks running at once
prefetch concurrency * 2 Max tasks held in memory (drives backpressure)
idle_timeout_ms 60000 When an unrenewed in-flight task may be reclaimed
result_ttl_ms 300000 How long results live (0 drops, negative keeps forever)
burst False Exit once the queue drains
serializer / deserializer msgpack Wire codec; pass pickle.dumps/pickle.loads to send datetimes/objects

@app.task(...) accepts name, max_retries (default 3), backoff_ms, timeout (seconds), and priority. Use task.options(delay_ms=…, schedule_ms=…, priority=…, task_id=…).enqueue(...) for one-off overrides.

Development

$ docker compose up -d      # Redis on localhost:6379
$ uv run pytest             # test suite (needs Redis)
$ uv run ruff check .       # lint
$ uv run ty check ardiq tests   # type-check

After changing the Rust core, rebuild with uv sync --reinstall-package ardiq.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ardiq-0.1.0-cp39-abi3-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9+Windows x86-64

ardiq-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

ardiq-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

ardiq-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

ardiq-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file ardiq-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: ardiq-0.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ardiq-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 74b123ed7f0eb7f353ee12a4cedd206730b69caeac5945a37565f3b54a530497
MD5 e56d992917b86e97159dd2161ec616b5
BLAKE2b-256 9e931fe991e590da9d0933b1557f1ab6c162c6be874446ffe4f47007df4aa03b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.1.0-cp39-abi3-win_amd64.whl:

Publisher: release.yml on 17tayyy/ardiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ardiq-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ardiq-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f1c23bbf67164b3fb3adda4ade0a3345d9e73ad403a022a478599117b8d0127e
MD5 bbb0bc716d10081701fcd690d7190734
BLAKE2b-256 be7fee51d9cee2e483926a6396c3e2e9ace10915550070aaebf4aad0de3fc48b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on 17tayyy/ardiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ardiq-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ardiq-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c8176c58419a4f614f368b30ab36fb3ab20b010c91f47edeb728a01b4ee1c4c8
MD5 9123edfeb51bfa5c0f72543467850ec1
BLAKE2b-256 11f8180f6ed38adac384b65505f680baeeb31230f219c0adecdb08a84f82a6c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on 17tayyy/ardiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ardiq-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: ardiq-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.9+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ardiq-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e20d69306344ee71f09f40817f85029f1e6832efcbe1d4218bc626f574d52e47
MD5 fa4a63daf6faa7140298fd685c40b600
BLAKE2b-256 a1f591932295960d182f31ad286f08c345f67382240aaa4853ac1b75b181bad9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on 17tayyy/ardiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ardiq-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ardiq-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6baa01bba0c280c113268ed88d832ce3f699278cc44482f8e7e98b79e1ff5d37
MD5 0ec608c40594b2e5bf31dd32829f62e6
BLAKE2b-256 3c0439eff819b33b2f8e57f13202a17fa33d27879d4436b54d81e625c375a83d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on 17tayyy/ardiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page