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.1
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.1.tar.gz | 56.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| readie-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 91.2 kB
Release files / readie-0.2.1.tar.gz
| Download URL | readie-0.2.1.tar.gz |
|---|---|
| Size | 56.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26623fb61d70011e735bd645bc71c745ab9450a52b77253dc45cf66a5b9ad655
|
|
BLAKE2b-256 checksum How to use checksums |
a78276c6fbbe5302baa226525b77f56ec1ed5550b2d10ccb7373281729ee8cc9
|
| 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.1-py3-none-any.whl
| Download URL | readie-0.2.1-py3-none-any.whl |
|---|---|
| Size | 34.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c61c7019b5b811bd8883479d8c08794774a6d223e2cac75f0f158b3a0bc15a3
|
|
BLAKE2b-256 checksum How to use checksums |
d8576a0637b266c3eeabdef196fead8748e6f7755e7e7e6523b3988f51eaf88b
|
| 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.1
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.