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 Distribution

ardiq-0.1.1.tar.gz (23.8 kB view details)

Uploaded Source

Built Distributions

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

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

Uploaded CPython 3.9+Windows x86-64

ardiq-0.1.1-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.1-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.1-cp39-abi3-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

ardiq-0.1.1-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.1.tar.gz.

File metadata

  • Download URL: ardiq-0.1.1.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ardiq-0.1.1.tar.gz
Algorithm Hash digest
SHA256 740b9b27d45655fda05353a78ddb50bbf91a19c9389f4435e0dae67e3ea58b22
MD5 72c4684b5aa27c1ed4fdded14df0ecf3
BLAKE2b-256 ce47ce43f4dc580178fba175f6ac6d63ee2613ba02556ba19618c4d28fd147f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.1.1.tar.gz:

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.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: ardiq-0.1.1-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.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c0c0f9b138367fcf1af3941876f260942e458140e5c1c4f214677154ea77b267
MD5 432830159d764eb3fc520f590d4c4c8d
BLAKE2b-256 b16116192c71d3d40ec2b5209c4e247c2454bc2f355ccb503a1e78988ed0d6fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.1.1-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.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ardiq-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d223b8ac1d4004a8945856eeeae9a5d05bf2eb95a98ba3a032a5d7e8134b5433
MD5 37b92dd10cd8919ca07bd1cbf0ba0039
BLAKE2b-256 e4cde91a2d3e3fe43ea7e56fda1820d5096460c8de8074fe38fb9dff9ca6755e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.1.1-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.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ardiq-0.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 31d0e9f59d9b3b8b48c8327a5e780eff61b5ad244df9d8d47348d402c77b3726
MD5 f46218c75961e23bba2c8082c91ff570
BLAKE2b-256 535b412f4875455e80e7e7fb67c58b97504e185d587aecebd7f077f84abe95e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.1.1-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.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: ardiq-0.1.1-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.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f01166acc36badca185625fb84daee4bacd63dfd1450b25564dbb40dc6ff60a2
MD5 3857fa98781568852a666418d7c854c5
BLAKE2b-256 2bf0033f0c98250ce36cadd88a74e435982f02d0cf450c127cb00a072910eea4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.1.1-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.1-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ardiq-0.1.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 14fbe13ea63d424ce3902f8d64d6773b9ad55dc0a7551ef5461f400244a1c317
MD5 1e7bf8fc1c6a91f53bdb72d0df7087c6
BLAKE2b-256 b600f2bc04a0f5bd1c24f58094ed06612ecddc1b8006d464458b3d450f04cf9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ardiq-0.1.1-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