Skip to main content

Zakuro

Run Python functions on a pool of workers that routes around slow and dead machines.

PyPI Python License

Documentation • Quickstart • API reference • Changelog


Decorate a function, hand Zakuro a pool of workers, and each call goes to the worker that should finish it soonest. Zakuro learns from every call, resends a call when its worker dies, and stops sending work to machines that are slow or gone. Your code doesn't change.

Try it in one command

git clone https://github.com/zakuro-ai/zakuro && cd zakuro
uv run demo.py

uv installs the published zakuro-ai package into a throwaway environment and starts three workers on your machine. They count the primes below 100,000,000 in 200 chunks, and a third of the way in one worker is killed with no warning. On an Apple-silicon Mac it takes 6 s from git clone to this, install included (17 s on a 2017 Intel laptop):

   50/200 [######..................]   calls sent: w0  21   w1  19   w2  25
  !! killing worker-1 (pid 41675) mid-job

   75/200 [#########...............]   calls sent: w0  31   w1  29   w2  35
  100/200 [############............]   calls sent: w0  46   w1  37 (down)   w2  49
  ...
  200/200 [########################]   calls sent: w0 103   w1  37 (down)   w2 100

  primes below 100,000,000: 5,761,455  (known answer 5,761,455) -- correct
  200/200 calls succeeded, 0 lost; 10 call(s) hit the dead worker and were resent elsewhere
  worker-1 marked suspended by the health probe; finished in 3.1 s

No GPU, no Docker, no account.

Use it

pip install 'zakuro-ai[worker]'
import zakuro as zk

@zk.fn
def square(x: int) -> int:
    return x * x

workers = [zk.Worker.spawn() for _ in range(3)]          # three workers on this machine
pool = zk.AdaptiveCompute(workers=[w.compute(verify=False) for w in workers],
                          max_dispatch_retries=2)        # a failed call is resent to another worker
print(square.to(pool)(7))                                # → 49, on whichever worker is fastest

To run across machines, install zc, the Zakuro broker and CLI, from crates.io (the crate is zc2; it installs the zc command). It needs a Rust toolchain (rustup.rs) and a C compiler/linker (build-essential on Debian/Ubuntu, Xcode Command Line Tools on macOS):

cargo install zc2 --locked
zc login                               # sign in in the browser
sudo -E "$(command -v zc)" connect     # join the mesh

Run zc login as yourself, not with sudo: it also gives this machine its own mesh identity. Joining the mesh brings up a WireGuard tunnel, so it needs wireguard-tools (apt or Homebrew) and root. -E keeps your sign-in, and the full path is there because sudo does not look in ~/.cargo/bin.

Then address a machine on the mesh by its node, not its IP. zk.nodes() lists them, and the address survives the machine moving:

square.to(zk.Compute(uri="zc://node-dd715b7f0a1c2e34", verify=False))(7)

A node with no free worker of its own forwards the call to another machine, which is paid, so give it a budget in yen: square.to(zk.Compute(uri="zc://node-dd715b7f0a1c2e34", verify=False, processor_options={"budget": 10}))(7). Without one the broker answers BUDGET_REQUIRED.

Everything else is in the documentation: install options, concepts, choosing a transport, the zc broker and the Python API reference. For ML training on top of Zakuro, see Sakura.


If Zakuro is useful to you, a ⭐ helps other people find it, and it's the easiest way to follow new releases.
Contributing • Security • BSD-3-Clause

Metadata

Release files for zakuro-ai 0.2.29

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for zakuro-ai 0.2.29
File Interpreter ABI Platform Actions
zakuro_ai-0.2.29-py3-none-any.whl Python 3 none any Details for zakuro_ai-0.2.29-py3-none-any.whl

Release files / zakuro_ai-0.2.29-py3-none-any.whl

Download URL zakuro_ai-0.2.29-py3-none-any.whl
Size 167.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
371ec4a9ffddfad97c47c1ceecccc05be14c8dfdc4e7c8c2f828db83324eda89
BLAKE2b-256 checksum
How to use checksums
74ed99927cf34854f123290e8146560412f02b7443e3054f02213be821bdcda6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for zakuro-ai 0.2.29

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.29 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page