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   # all four brokers 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.3.tar.gz (243.9 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.3-cp314-cp314t-win_amd64.whl (3.9 MB view details)

Uploaded CPython 3.14tWindows x86-64

tarsk-0.1.3-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.3-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.3-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.3-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.3-cp311-abi3-win_amd64.whl (3.9 MB view details)

Uploaded CPython 3.11+Windows x86-64

tarsk-0.1.3-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.3-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.3-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.3-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.3.tar.gz.

File metadata

  • Download URL: tarsk-0.1.3.tar.gz
  • Upload date:
  • Size: 243.9 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.3.tar.gz
Algorithm Hash digest
SHA256 b43b5fb95e00ba8586adf2f3aa22cf0b76a590a62807b02caab01fffa93758e6
MD5 93dc4b2c6e920b9e8944ff3d43af6d2f
BLAKE2b-256 a589f0f9e626a2d3748d1c40b61eb4cbd0b1449c7951ced067d65dea8f19d57d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.3-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.3-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 4661e05900050a2ab27d561504faccb35c629e9d449d558bcd575f0bff958bc8
MD5 609461a7aabc2b1b514b23a72689c46f
BLAKE2b-256 51ef2f951457dc7438f853e417ab50936144b2bf3aebbc6d17cd75d7df2398e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.3-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.3-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 56a3919fbdef3954baaa5d7f7c1eef70a503696a9dd08640d0f93d7c9f48802d
MD5 3e39ee7a122b8364d9a43ba2efc2317c
BLAKE2b-256 df01fc669ca09d97aec240a25fe94a808e3ada826c275465c73a93fca79685fd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.3-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.3-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b4b2f707d4bfd8f390949e9d6a6056ccc09d3d4155ac58a248bcba6cc365eb15
MD5 227ed8707e9e3e36296e1b1dac832add
BLAKE2b-256 de62083ff044f57a8471b26f2e89dd98b769af9e2f867efb6470e7fa065cff55

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.3-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.3-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5c42201f21779ff26aa4ac1b709c1ea22989e1f70eb8a26a2c4755b2c3201529
MD5 329ba8b58c6a034e85dafe6948687d33
BLAKE2b-256 00bc3b60e4fb0420d359b03ada07dd9ef70c70b710ef5b21e4275679aa290e29

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.3-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.3-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 fb45f2e7e69cb62d15bd8864c8d0304b597105b555997355afab2d01de5b38d9
MD5 d43d016f21b9fe70d01de953df57baa6
BLAKE2b-256 751f05e79ef62bd3724e251fba2267f3d57a0addcd80c0f59ed6600f0c0de577

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.3-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.3-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f4054e39a65758055eb23e87abeb77af6fc151a1437ebc20d39ada9499d445ba
MD5 4e5ec98ce08a114e32938504f39556e6
BLAKE2b-256 6657b622dd013fe26d2dfb859828c93f87802eaa0eba2b8972b02e8bac2ffa4f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.3-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.3-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3acd5a621976f00a8b176658d66a310126c60dd2a1e00588ba73e02c8a3c1618
MD5 b1be7ea5ebc771de2c6d76a7b784b3dd
BLAKE2b-256 ce7256843a77d3634d5fd55cf49437065d1724381a81c96ea795eaa13b48096c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.3-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.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5d8464fecafdc5caf780c0615b367866de8e3aef3895d82f8e03ee22faee433
MD5 c0d60976d7df6f08904d790d94ad754c
BLAKE2b-256 4fa394a0f5fd637292cbd9484f3e13b7d19bb2d8d9095da2944b7d3d25ce109a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.3-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.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bc2df116fa7b3cfca432fc944de8a2be0b4551f282769ac23146948fd9b40173
MD5 19ee7020b468d379c4d0919bbe87a674
BLAKE2b-256 6ca5643428b3a7ace9b8cfe82c4fe5f03a49d8421d495166ec4624a0d37ceb2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.3-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.3-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 7168620ba9618dbee06a5fdb9e73f5206190a286882a10d818d5b0e0d350441b
MD5 cf77910afb70ef5b21b9a3cad16bf062
BLAKE2b-256 2a6e1328d0cb701125ada3411465af0a0d128555ea59b03389028c2de6b63420

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

11 files

0.1.2

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