Quick start
Run a Python function through a queue and get the result back. The first half needs nothing but Python; the second half points the same code at a control plane.
To host your own control plane, follow Setting Up Lakeshore Service.
Before you begin
- Python 3.11+ —
python --version - Nothing else, for Part 1.
A bare @udf runs in-process, and queue-bound UDFs fall back to a local
SQLite dispatch plane under ~/.lakeshore whenever LAKESHORE_URL is
unset. Steps 1–4 need nothing installed but Python; a control plane only
enters the picture at Step 5.
Step 1 — Install the SDK
Imports are lazy: a purely local run never pulls in httpx or msgpack.
Step 2 — A local function
A bare @udf is a plain in-process call. No queue, no worker, no
network:
Step 3 — A queue round-trip, with zero infrastructure
Bind the function to a queue and it submits instead of running. The handle you get back is the invocation id — a plain string, not a Future.
dls.Dispatch is a single SQLite store — no control plane, no daemon,
no network. Swap it for a real plane later and none of the decorated
code changes.
Step 4 — Fan out
There is no gather() helper, because there is no Future type. A list
comprehension is the spawn and a loop is the barrier:
asyncio.gather over the awaitable Queue.result is the join. Results
come back in submission order.
Step 5 — Point it at a control plane
Two things change: where the dispatch plane lives, and who runs the worker.
Authenticate
That writes ~/.config/lakeshore/auth.yml (mode 600) with server,
namespace, and token. In a notebook, use environment variables
instead:
With LAKESHORE_URL set, the SDK's default dispatch plane becomes
HttpDispatch against that control plane, and your code needs no
_dispatch= argument at all.
Run a worker
lakeshore daemon … manages the Rust fleet daemon, which supervises
shell commands and invocations from the control plane. Queue-bound
Python UDFs need lakeshore worker start, which spawns
python -m dreamlake.lakeshore.daemon. The worker deliberately ignores
saved auth login credentials — pass --url / --token, or set
LAKESHORE_URL and LAKESHORE_CLIENT_TOKEN.
Submit
Step 6 — The CLI for fleet management
The SDK submits work. The CLI manages the fleet:
See CLI installation to install and log in.
Where to next
| I want to… | Page |
|---|---|
Understand @udf in depth | @udf decorator |
| Work through it as a tutorial | Hello UDF |
| Understand queues | Queues |
| Move data in and out | Storages |
| Declare a cluster in YAML | Compose |
| Set up cloud providers | Providers |
| Auto-scale workers | Elasticity |
| Full CLI reference | CLI |