main
version. Click here to see docs for the latest stable version.
- __init__(name: str, image_id: str | None = None)[source]
Runhouse Image object, specifying cluster setup properties and steps.
- Parameters:
name (str) – Name to assign the Runhouse image.
image_id (str) – Machine image to use, if any. (Default:
None
)Example
>>> my_image = ( >>> rh.Image(name="base_image") >>> .setup_conda_env( >>> conda_env_name="base_env", >>> conda_config={"dependencies": ["python=3.11"], "name": "base_env"}, >>> ) >>> .install_packages(["numpy", "pandas"]) >>> .set_env_vars({"OMP_NUM_THREADS": 1}) >>> )
Set up and use an existing Docker image.
image_id (str) – Docker image in the following format “<registry>/<image>:<tag>”
docker_secret (Secret or str, optional) – Runhouse secret corresponding to information
necessary to pull the image from a private registry, such as Docker Hub or cloud provider.
See DockerRegistrySecret
for more information.
Install the given packages.
reqs (List[Package or str]) – List of packages to install on cluster and env.
node (str, optional) – Cluster node to install the package on. If specified, will use ssh to install the
package. (Default: None
)
conda_env_name (str, optional) – Name of conda env to install the package in, if relevant. If left empty,
defaults to base environment. (Default: None
)
Sync the contents of the source directory into the destination.
source (str) – The source path.
dest (str) – The target path.
contents (Optional[bool], optional) – Whether the contents of the source directory or the directory
itself should be copied to destination.
If True
the contents of the source directory are copied to the destination, and the source
directory itself is not created at the destination.
If False
the source directory along with its contents are copied ot the destination, creating
an additional directory layer at the destination. (Default: False
).
filter_options (Optional[str], optional) – The filter options for rsync.
Run bash commands.
command (str) – Commands to run on the cluster.
conda_env_name (str or None) – Name of conda env to run the command in, if applicable. (Defaut: None
)
Set environment variables.
env_vars (str or Dict) – Dict of environment variables and values to set, or string pointing to local .env file consisting of env vars to set.
Setup Conda env
conda_env_name (str) – Name of conda env to create.
conda_config (str or Dict) – Path or Dict referring to the conda yaml config to use to create the conda env.
Enum for valid Image setup step types
A component of the Runhouse Image, consisting of the step type (e.g. packages, set_env_vars), along with arguments to provide to the function corresponding to the step type.
step_type (ImageSetupStepType) – Type of setup step used to provide the Image.
kwargs (Dict[str, Any]) – Please refer to the corresponding functions in Image to determine the correct keyword arguments to provide.