Skip to main content

tarsk

A Python task queue whose workers hold a memory ceiling you set — without losing a task.

task with rust through the middle. The scheduler, retry state machine, lease tracking and child supervision are Rust; the only Python in the hot path is your handler.

Status: 0.1.0, not yet on PyPI. The core works and is tested; the wheel builds and installs. See What is missing.

📖 Documentation — everything below the fold lives there: how it works, writing tasks, routing and scheduling, operating, benchmarks.

from tarsk import App

app = App(broker="redis://localhost:6379/0")

@app.task(retries=3, timeout=30, queue="heavy")
def embed_document(doc_id: str) -> dict:
    ...

task_id = embed_document.send("abc")
tarsk worker --app myapp:app --broker redis://localhost:6379/0 \
             --queues heavy --children 4 --max-rss 400MB --metrics 0.0.0.0:9090

Handlers must be idempotent. Delivery is at-least-once. This is a contract, not a footnote: a worker killed mid-task will run that task again.

What it does that others do not

child RSS over one hour under a leaky handler, and the supervisor holding it

One hour, 72,001 tasks, a handler that never frees anything. 66 recycles, peak 400 MB against a 400 MB ceiling, no sample over it, nothing killed, nothing lost. The flat line beneath the sawtooth, on the same axis, is the supervisor doing the holding: 28.32 to 28.40 MB across the hour, a drift of 82 KB. A ceiling enforced from inside a process with the same problem would only defer it.

Every Python task queue leaks, because leaks come from the code they run rather than from the queue. The difference is what the runtime does about it.

--max-rss is a byte budget. Celery's --max-tasks-per-child is a task count, which only bounds bytes if you already know how many bytes a task costs — and stays wrong once that changes. Same configuration, different workloads:

leak 20MB/task leak 40MB/task payload-dependent 2–80MB
celery --max-tasks-per-child=6 162 MB 282 MB 327 MB
tarsk --max-rss=200MB 183 MB 183 MB 187 MB

Celery wins the first column, and that is the honest result: when the leak per task is known and constant, dividing the budget by it works — someone divided 200 by 20 and typed 6. It is the other two columns tarsk was built for: nothing was reconfigured between them, the workload moved, and the guess encoded in that 6 went with it.

The worker that runs your code is 27 MB against Celery's 41 MB and taskiq's 44 MB, because it imports your tasks and nothing else — no broker driver, no scheduler. Recycling costs 7 ms at the 99th percentile against Celery's 139 ms, because the replacement child starts before the trigger fires and the slot never goes empty.

What it does not claim

Not faster. With a 50 ms handler tarsk, Celery and taskiq all reach 19–20 tasks/s. Draining 10,000 no-op tasks across four processes: Celery 10.0s, taskiq 2.3s, tarsk 2.2s — ahead in every run and by 4%, which this project's own benchmark rules call a tie. It starts in half the time and runs in half the memory; that is the claim, and speed is not.

This file claimed a 1.45× lead until the numbers were checked on more than one machine. The full retraction, and every column where tarsk loses, is in the benchmarks.

Not a hard ceiling regardless of task size. The ceiling is read while a child is idle, so a child never starts a task it cannot afford — but a handler that allocates 300 MB will allocate it. Overshoot is bounded by one task's peak, not by zero.

Not durable execution. That is Temporal's category, and it is much heavier.

What is missing

  • Not on PyPI yet — the wheel builds and installs, it just has not been uploaded
  • No chord. chain and group are here; fanning back in to a callback is not
  • Windows runs the suites that need no broker, since neither Redis nor Postgres ships for it. Everything else — the channel, recycling, the memory ceiling — is tested there

Running the tests

The toolchain is pinned in mise.toml — Rust 1.94.0 and Python 3.14.3, the versions the published numbers were produced with. With mise installed, mise install fetches both and entering the directory creates .venv from the pinned Python. Without it, any Python 3.11+ and a recent stable Rust will build: the wheel is abi3-py311.

python -m venv .venv && .venv/bin/pip install maturin msgpack
.venv/bin/maturin develop --release

.venv/bin/python tests/test_ipc.py       # protocol, timeouts, retries
.venv/bin/python tests/test_recycle.py   # the ceiling, soft timeouts, middleware
.venv/bin/python tests/test_brokers.py   # Redis and Postgres end to end
cargo test --lib                         # cron, console, socket permissions

The broker tests start their own redis-server and Postgres cluster and skip whichever is not installed. python demo/run.py --minutes 1 --ceiling 150MB --rate 30 is the definition of done in miniature: it exits non-zero if a task goes missing or the supervisor drifts.

License

MIT — see LICENSE.

Download files

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

Source Distribution

tarsk-0.1.0.tar.gz (210.5 kB view details)

Uploaded Source

Built Distributions

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

tarsk-0.1.0-cp314-cp314t-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.14tWindows x86-64

tarsk-0.1.0-cp314-cp314t-musllinux_1_2_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

tarsk-0.1.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64

tarsk-0.1.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.7 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ ARM64

tarsk-0.1.0-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (5.7 MB view details)

Uploaded CPython 3.14tmacOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

tarsk-0.1.0-cp311-abi3-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11+Windows x86-64

tarsk-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ x86-64

tarsk-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view details)

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

tarsk-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.7 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

tarsk-0.1.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (5.7 MB view details)

Uploaded CPython 3.11+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file tarsk-0.1.0.tar.gz.

File metadata

  • Download URL: tarsk-0.1.0.tar.gz
  • Upload date:
  • Size: 210.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tarsk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 09547d50b6218ab25c36482e3e6b77ba84d1ff3644dded5008bdc31b0f903e84
MD5 749f121c9331db70246a1b7ca52c3f3f
BLAKE2b-256 67687627c80b87d8feb61eee02faaa83e147703bbf5a99e7eb1470928257442b

See more details on using hashes here.

File details

Details for the file tarsk-0.1.0-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: tarsk-0.1.0-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.14t, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tarsk-0.1.0-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 908949a85a4db9a955d20fee6304b3af7bf074530ff92f06162ad6514325045e
MD5 6e0fd671a479490896033b034b5490d4
BLAKE2b-256 8dc769a1656d22c2f7c219b2882334e6867e71b08fff87bcd25790d216163442

See more details on using hashes here.

File details

Details for the file tarsk-0.1.0-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: tarsk-0.1.0-cp314-cp314t-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: CPython 3.14t, musllinux: musl 1.2+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tarsk-0.1.0-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 04fc08ee86c9bcb5eb7254e98584ed9670ef87388d27933cd8aa43d072ddb562
MD5 6e6d264a7102b24bd4d72053f5727b4b
BLAKE2b-256 404afae0a562d7bc1c922430ceb0ceead0e58b2dac0f299cca5d5901ceaf1b1c

See more details on using hashes here.

File details

Details for the file tarsk-0.1.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: tarsk-0.1.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.14t, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tarsk-0.1.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 989d166912d0d08ae023b65e0e6241789f4f97e243f450939a62dcbebad31cad
MD5 3512c1b20ad1e0be51e5b1c9ff89f243
BLAKE2b-256 2bb714dde7b737b633e1e28d32530702739cabcf0d5ea8bce3bbe9a0157b8e82

See more details on using hashes here.

File details

Details for the file tarsk-0.1.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: tarsk-0.1.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.14t, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tarsk-0.1.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2fa714d1af24214306bc7a3f551124deaddee208b26237e2bad27143075f87f0
MD5 7f32ea5c8a0e281fbab02b9d38444fef
BLAKE2b-256 3f7d0f9d85417f5455df7f5cd03a55570f3ff461f54e788227b8876e3249c2e9

See more details on using hashes here.

File details

Details for the file tarsk-0.1.0-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

  • Download URL: tarsk-0.1.0-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
  • Upload date:
  • Size: 5.7 MB
  • Tags: CPython 3.14t, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tarsk-0.1.0-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 889eae310854a534f0e64956dde44e016b6fa133d302d630a65d41033f5fda6e
MD5 060840f4b60f60ef9ee53614bfba0991
BLAKE2b-256 ca5512f97cbbb04007fd377d257219a2cea789c243690e5e914e86665b086493

See more details on using hashes here.

File details

Details for the file tarsk-0.1.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: tarsk-0.1.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tarsk-0.1.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e075c25111ae07412a68ecdcf0d3b2198fa635c368138428937fc7787c1de3ea
MD5 a459b3a2f1a2d392d63fb9de52ca43e9
BLAKE2b-256 6836fd21bedaf3682b0713cc4590c6e71f69ee194289051baf7ec27c4396ce55

See more details on using hashes here.

File details

Details for the file tarsk-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: tarsk-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: CPython 3.11+, musllinux: musl 1.2+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tarsk-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 35a474acaf42898f8cd651d796fd9e0b14df54c60a9513949a2afa433ddb09ed
MD5 864018ceefd313103b8a00fb304e93a6
BLAKE2b-256 509f1b19e47363693f4c6787e1eb8ae48039a980950821dc1146ad2741583a5e

See more details on using hashes here.

File details

Details for the file tarsk-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: tarsk-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tarsk-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4dbbf53bf29fcc9fdd43ff4ad428dbf87c4230a13149a61a49a4724df2c5044b
MD5 a50065152adc42a6b199e40a06d15bfa
BLAKE2b-256 d3593da39679acc7d0767c59b37c4327a479fe35019cd370826b800bc469504f

See more details on using hashes here.

File details

Details for the file tarsk-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: tarsk-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.11+, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tarsk-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 10c3e75096434a850ca904d2c4c1b697349054a8df0d8b79b00e810f612bdee4
MD5 abfe9aad49402e10b40fe32759d2fdc4
BLAKE2b-256 2d870a9127222df89cc76cbb8b9f7217d6b627ae712d14ba48c815593e1a7c4c

See more details on using hashes here.

File details

Details for the file tarsk-0.1.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

  • Download URL: tarsk-0.1.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
  • Upload date:
  • Size: 5.7 MB
  • Tags: CPython 3.11+, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tarsk-0.1.0-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 2490dc8d59d92c069c6f7ec470c17b99bc6826b46bb67cd725bb05cde4aca217
MD5 28e023d034304647aa066b03d9041cf7
BLAKE2b-256 2c6d5d26b99b07a263b55bf08755bc3d074bddc4a9d691f487695d32bc08cebe

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.3

11 files

0.1.2

11 files

0.1.1

11 files

This release

0.1.0 This release

11 files

Supported by

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