Define a pod
Save this astools.py:
authorized=True makes the URL take the same
bearer token as an endpoint.
Deploy it
lazycloud deploy runs the pod in the cloud and prints its URL. The
vLLM example deploys a model server this way.
keep_warm seconds idle, 600 by default. keep_warm=-1 keeps one up at all
times, which suits a model server that can’t wait for a cold start. Pods don’t
autoscale, so more containers means a count:
scale, and web.scale(n) does the same from
Python.
Create an instance on demand
A pod can also run once without a deployment. With an access token inLAZYCLOUD_TOKEN, this starts
an instance, fetches the directory listing, and stops it:
web.run("python", "--version") starts one with a different command. An
instance has a url and terminate(), and lives for keep_warm seconds unless
timeout_seconds says otherwise.
Pod options
env, secrets, volumes, and machine work as on every workload, and
web.shell() opens a shell in a pod container.
TCP connections
tcp=True exposes a raw TCP port at a tls://hostname:port address. Clients
connect with TLS and send that hostname as SNI. TCP pods are always public, so
the server authenticates its own clients.
Stop and clean up
stop keeps the definition and delete removes it, like web.pause() and
web.delete() in Python. A running deployment replaces any container you stop
by hand, so stopping the deployment is what keeps a pod down.
