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):

cargo install zc2 --locked

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)

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.27

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.27
File Interpreter ABI Platform Actions
zakuro_ai-0.2.27-py3-none-any.whl Python 3 none any Details for zakuro_ai-0.2.27-py3-none-any.whl

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

Download URL zakuro_ai-0.2.27-py3-none-any.whl
Size 165.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25f64412ee157c190077dbaaaffadf5e6e09949bbc7805048da5d52f66d92e7c
BLAKE2b-256 checksum
How to use checksums
7eb2620925feadc086e91dba361fe02ad3b7c5ff035c10501824f4b2659cdd55
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.27

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.27 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