main
version. Click here to see docs for the latest stable version.Runhouse clusters expose various functions that allow you to set up state, dependencies, and whatnot on all nodes of your cluster. These include:
cluster.install_packages(...)
cluster.rsync(...)
cluster.set_env_vars(...)
cluster.run_bash(...)
A Runhouse “Image” is simply an abstraction that allows you to run
several setup steps before we install runhouse
and bring up the
Runhouse daemon and initial set up on your cluster’s nodes. You can also
specify a Docker image_id
as the “base image” of your Runhouse
image.
Here’s a simple example of using the Runhouse Image abstraction in your cluster setup:
import runhouse as rh image = ( rh.Image(name="sample_image") .from_docker("python:3.12.8-bookworm") .install_packages(["numpy", "pandas"]) .sync_secrets(["huggingface"]) .set_env_vars({"RH_LOG_LEVEL": "debug"}) ) cluster = rh.cluster(name="ml_ready_cluster", image=image, instance_type="CPU:2+", provider="aws").up_if_not()
I 12-17 12:04:55 provisioner.py:560] Successfully provisioned cluster: ml_ready_cluster
I 12-17 12:04:57 cloud_vm_ray_backend.py:3402] Run commands not specified or empty.
Clusters
AWS: Fetching availability zones mapping...NAME LAUNCHED RESOURCES STATUS AUTOSTOP COMMAND
ml_ready_cluster a few secs ago 1x AWS(m6i.large, image_id={'us-east-1': 'docker:python:3.12.8-bookwor... UP (down) /Users/rohinbhasin/minico...
[?25h
The growing listing of setup steps available for Runhouse images is available in the API reference.