readie-client
Run a Python function on a remote checkpoint-restore worker by decorating it.
from readie import remote
@remote
def add(a, b):
return a + b
print(add(1, 2)) # blocking
print(await add.aio(1, 2)) # from an event loop
The decorated function is serialised with cloudpickle and executed by a Python
interpreter inside a gVisor sandbox, so it must be picklable and its imports must
exist in the worker's image.
Resource budgets
Declare how much memory a function needs on the decorator. Each budget takes a
byte count or a size string ("512Mi", "4Gi"); an unset budget falls back to
the cluster default.
@remote(gpu=True, memory="2Gi", max_memory="8Gi")
def train(rows): ...
memory is the container's initial limit and max_memory the ceiling the
worker may auto-expand to when the function needs more; gpu_memory /
max_gpu_memory are the same for GPU device memory. gpu=True sends the call to
a GPU worker (a gpu_memory budget implies it too). The client also statically
extracts the function's imports and forwards them so the router can pick a
checkpoint that already imported them - this is automatic and needs no
configuration.
make install # sync the virtualenv from the lockfile
make test # unit + in-process gRPC integration tests
make lint type # ruff + mypy --strict
Configuration options:
import readie
readie.configure(router_uri="localhost:50051", timeout=120.0, stream_logs=True, tls=False)
The following are configurable only from the environment:
READIE_AUTH_TOKEN |
bearer token for a router that requires one; unset sends none |
READIE_TLS_CA |
connect over TLS; a CA path verifies the nginx server, |
| else system roots. TLS is required for HTTPS router URIs |
When a remote function raises
You get the real traceback, from the process that raised it:
try:
train()
except readie.RemoteExecutionError as error:
print(error.remote_type) # "ValueError"
print(error.remote_traceback) # the frames inside the sandbox
print(error.worker_id, error.container_id)
The exception object is not reconstructed. Unpickling it would need its class
importable here, and for a library that exists only in the worker image the
resulting ImportError would replace the real error with a confusing one.
EmptyResultError means something else entirely: the worker returned nothing at
all, so the executor died before it could report an outcome. A function that
returns None returns a value and does not land there.
Sessions
By default every call is independent and gets a fresh container. To reuse a warm container - and the Python state it holds - open a session:
with readie.default_client().session() as s:
load_data.bind(s)() # cold start
train.bind(s)() # resumes the same interpreter
Calls inside one session are serialised by the router: a session maps to one container running one interpreter behind one socket, so they cannot safely run at once. Unrelated sessions stay fully parallel.
Metadata
Release files for readie 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| readie-0.2.0.tar.gz | 83.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| readie-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 117.4 kB
Release files / readie-0.2.0.tar.gz
| Download URL | readie-0.2.0.tar.gz |
|---|---|
| Size | 83.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68c5a2380e7476448e1a3994535fa647bc47aea7f75559d60ffe46a0363eacac
|
|
BLAKE2b-256 checksum How to use checksums |
fc1abd3499ac90d2ca26eb461bee7587b184a0d15504390855313dfb382a0f88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| 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":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / readie-0.2.0-py3-none-any.whl
| Download URL | readie-0.2.0-py3-none-any.whl |
|---|---|
| Size | 34.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
abe11834f093e37a98753b9b0b77be41da1ba00fb3440bad2ef7818265c42c33
|
|
BLAKE2b-256 checksum How to use checksums |
fcab4307b1141505340b8f782a5dbb2ab422ea47a87036c25e927a6532b83eb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| 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":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for readie 0.2.0
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.