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.

PyPI Python License

pip install tarsk

Status: early. The version badge above reads live from PyPI — a number written here went stale twice before this sentence replaced it. Wheels for Linux (glibc and musl, x86_64 and aarch64), macOS universal2 and Windows x64, on Python 3.11 through 3.14 including the free-threaded build. 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

  • 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, Postgres, RabbitMQ end to end
cargo test --lib                         # cron, console, socket permissions

The broker tests start their own redis-server and Postgres cluster, use any RabbitMQ answering on the conventional ports (or TARSK_AMQP_URL), and skip whichever is missing — loudly, so a skip cannot pass for a pass. 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.2.tar.gz (241.3 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.2-cp314-cp314t-win_amd64.whl (3.9 MB view details)

Uploaded CPython 3.14tWindows x86-64

tarsk-0.1.2-cp314-cp314t-musllinux_1_2_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

tarsk-0.1.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64

tarsk-0.1.2-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.7 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ ARM64

tarsk-0.1.2-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (8.1 MB view details)

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

tarsk-0.1.2-cp311-abi3-win_amd64.whl (3.9 MB view details)

Uploaded CPython 3.11+Windows x86-64

tarsk-0.1.2-cp311-abi3-musllinux_1_2_x86_64.whl (4.7 MB view details)

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

tarsk-0.1.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view details)

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

tarsk-0.1.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.7 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

tarsk-0.1.2-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (8.1 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.2.tar.gz.

File metadata

  • Download URL: tarsk-0.1.2.tar.gz
  • Upload date:
  • Size: 241.3 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.2.tar.gz
Algorithm Hash digest
SHA256 938655a2c7e4a6687d145a4dd8dda21c56d03a9b62ec02b905b3886669411bb1
MD5 9211dd7f361febdd1e2b60374165ce2d
BLAKE2b-256 8849d88b97abb5a1c5d97222ea49b476e71d8e50b310e4499100e9dd29c0afd2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.2-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 3.9 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.2-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 1657515d00d2ae86b18c23f850419a76c363283ef4797c2b5d985fcf95d6bfe6
MD5 a1e26fc746025b18625b67d1c5d109bf
BLAKE2b-256 aae2134ab6fc62419d4578a1db610c9295f0227b6b60399ac34a9b128f0d9c63

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.2-cp314-cp314t-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 4.7 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.2-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 fc5015f2c7708293337847f74847f0d99884566c5888cf24275429a65a1238c1
MD5 7ee1e00328a9aa61d034459bf229cd4d
BLAKE2b-256 bc6a7f6c87cc096ae5930e7865e0bda96fd91f2d2e52a90515e45cf7ee362531

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.4 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.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a652e901c5f2ae16d504de6b6d52bce5a914e4355334c7d52e0426f4426002a
MD5 956a9e7cc3afacdeaf005ec44a6137cf
BLAKE2b-256 fcdb73653635d6137de89daa7e32519c03e50f58123666d2b270fe402dd70a4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.2-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 3.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.2-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6a624d72b5188e5135f4d4addfef4fc52352ced9c386ceca226d4d3fb1581c5f
MD5 2ce2264ce01ed7675f7943196eb6ffdf
BLAKE2b-256 1fe59c45cc796548b7740640ee74523bb57e19d69aa67caed780bd11a8791ee6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.2-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
  • Upload date:
  • Size: 8.1 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.2-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 dd3c4d797a35d8093f19d5125d0a975c6f086f48c04902d3800d645994a9c451
MD5 d120e6f3420cdc443d0cce4d5022fc76
BLAKE2b-256 28b00dcb574be4bf7ef9fcde553b41b088386d13ba4597f7def2ccee5ce6d4b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.2-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.9 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.2-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 61755545de90b4a1e95000758dfac43bfed519b795b94a2422fdce7c432a9271
MD5 baf0c9cb77050c3982d49dcba15ba2a6
BLAKE2b-256 f07c4e32a9a4ece95719f54476a6c0bee2f91b92e879994ecd7610839f7c5ac7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.2-cp311-abi3-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 4.7 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.2-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d7490c8853dab3fe5f6d363ce7d721471ea7cf73deea6ec2b58b07b8fde33ae5
MD5 f00f9009d28c038e49e3fabb9a459f20
BLAKE2b-256 5f06735c48d2332f4c3def0c2f9e99487ef77f760bca50806cad0bf0293d42a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.4 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.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8475dd3b6554cd1861a5448e91c839335ccf2e04e557cad44d53a5944652bba7
MD5 0be047eabd18919c99dff40e2798a36e
BLAKE2b-256 38e9c1d8322ddfca95bcc50811feadcec6fa850b229c4ee277bb8e846f244e33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 3.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.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8d50eaab94baae6e526141e7447c1c7db3da78e4e8b64962046fb60076b13d01
MD5 0455e1efa81a8ac0dbce9667e6a367e0
BLAKE2b-256 cc54c9857fd04f9eb2faf86ef2e6efb34e204d20082a15248eebc088e7ed7133

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.2-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
  • Upload date:
  • Size: 8.1 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.2-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 731add9e9f4cd213dafff530f8ee08c3416311c8d4624fdeeb21dcf16e80336d
MD5 79ee9a14bb9ee35eb945b92fe9339a1c
BLAKE2b-256 3cd0a321be804ed7a1be741cfbd0adbb13d8b644e0aeba0627f61847f231fb9d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.3

11 files

This release

0.1.2 This release

11 files

0.1.1

11 files

0.1.0

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