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: 0.1.0, the first release. 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 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.1.tar.gz (217.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.1-cp314-cp314t-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.14tWindows x86-64

tarsk-0.1.1-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.1-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.1-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.1-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.1-cp311-abi3-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11+Windows x86-64

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

File metadata

  • Download URL: tarsk-0.1.1.tar.gz
  • Upload date:
  • Size: 217.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.1.tar.gz
Algorithm Hash digest
SHA256 09f9240f12caf7082061872cdfc0d231b5e127cad6b1bff9563239c10bcc73b0
MD5 62925724e327490b8347c7de6c05767b
BLAKE2b-256 ed9611ba981d0198d58d3e2db577e304dcee7cf86c5e4ae5f32fa73ff0b147d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.1-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.1-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 ee3db924819a1059f4223ada664d094578f04d2705bf1185d6add2c4b0365ec7
MD5 309e415036e4e3ec6b98f8d553b8d347
BLAKE2b-256 dc69207585e4f3556c498d17912222c8c9b999f14618f1d12439d4b4cef4dc98

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.1-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.1-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ed099a884305761b39ee50f973a41e896dff4bcb689a1708b51ee4ebf7654e62
MD5 bd410a9a23397f3690788378eb1e496a
BLAKE2b-256 14907ad2d4ba8e36eb0a3fbce5fc59ca876606ae3273d6b9c9ad4260ed580581

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.1-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.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 369ef0ac4f16d5fe36845072e8845a66f974d7f49f77ee2a48a50f64c3e8e6af
MD5 201b61482e49a4938f8ab81f0473d003
BLAKE2b-256 263d3c8e404dfea7eaa9e61aa406be4983d2678b7f9d60a7f7e86323dcdec7b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.1-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.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a57e119be39d7c9845c88a6cca97b567a287b36d274694371796e2216987b0b8
MD5 6206dab8a39e23fe8f252e9fa55d46f6
BLAKE2b-256 a481f851138c95b8d2a2ec296811df80e1266dbfc3246d40226aa0ab0d0600d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.1-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.1-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 892a9ec99a2fc01500b057f1f769d5cf608ffcdb7ca7a52ee77358c69858e1cc
MD5 5b67b76f662b2110a3c574b58cba1271
BLAKE2b-256 486aa7d1bc768e36e4a6b1ae6d8d018a7f69933628c1caee0ae4acd8af622f1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.1-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.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 66d407d26c2d8b68e68d12ae179ddee8a5774eb572eda03d840028fd7aa8f385
MD5 fb8f9bac3984ce7824fe4495f3c7b043
BLAKE2b-256 b288b260459aab817930a046668591246e1961efc39d603b98e08615b68bde97

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.1-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.1-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a6c30f51f98fe16ad4aa187434d8bdfa3722721b0a9dba174045684a6b66e33a
MD5 451aae2ab3e35e3c8ed3cdae33c76f3f
BLAKE2b-256 6a67732a904b9d270186e644127d1740031f0b56ca821ba4d3a886fbe74af890

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.1-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.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d8e52512df9128a2ad4b66d80a4bac798bc781c49ab03ee1b8c822b25849bbf3
MD5 b9b4e7909feb4d9a3999bd26b99f8c3f
BLAKE2b-256 ffe2b5ca458e01344f76c081b43e71f4b70822532d569627f06fb27a9a2f0956

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.1-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.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 54a0dcdfca1d543aa405b5118ae38b0d1e45fecdaf1a6c2716cfd0f93843a97d
MD5 a6aa71124864fdd6806dcc0db9683978
BLAKE2b-256 306a13194c783778ba9a132dc18493859877d6dd64f97ad33a759b53ec5bb6c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tarsk-0.1.1-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.1-cp311-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 84d99aca7bb195017ea46692614945c1be3fac97d01e3d1843ecdf3a2399485d
MD5 21f6b3765ae31d917c6d64336d78bdb4
BLAKE2b-256 f4eeb1207ea9602b76533af38c8e279bafa5ccaa6aac9ceaefed66ec021431cb

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.3

11 files

0.1.2

11 files

This release

0.1.1 This release

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