From 23ca976e15f428915ca9384e43cd337dd29374d9 Mon Sep 17 00:00:00 2001 From: Caroline Chen Date: Wed, 11 Dec 2024 17:18:45 -0500 Subject: [PATCH] Rename conda_yaml with conda_config (#1581) --- runhouse/resources/hardware/cluster.py | 6 +++--- runhouse/resources/images/image.py | 8 ++++---- runhouse/utils.py | 6 +++--- tests/fixtures/docker_cluster_fixtures.py | 2 +- tests/fixtures/on_demand_cluster_fixtures.py | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/runhouse/resources/hardware/cluster.py b/runhouse/resources/hardware/cluster.py index 983fa28aa..f1024274b 100644 --- a/runhouse/resources/hardware/cluster.py +++ b/runhouse/resources/hardware/cluster.py @@ -633,7 +633,7 @@ def _sync_image_to_cluster(self): if setup_step.step_type == ImageSetupStepType.SETUP_CONDA_ENV: self.create_conda_env( conda_env_name=setup_step.kwargs.get("conda_env_name"), - conda_yaml=setup_step.kwargs.get("conda_yaml"), + conda_config=setup_step.kwargs.get("conda_config"), ) elif setup_step.step_type == ImageSetupStepType.PACKAGES: self.install_packages( @@ -1952,11 +1952,11 @@ def run_python( return return_codes - def create_conda_env(self, conda_env_name: str, conda_yaml: Dict): + def create_conda_env(self, conda_env_name: str, conda_config: Dict): install_conda(cluster=self) create_conda_env_on_cluster( conda_env_name=conda_env_name, - conda_yaml=conda_yaml, + conda_config=conda_config, cluster=self, ) diff --git a/runhouse/resources/images/image.py b/runhouse/resources/images/image.py index 1e93cafe0..8c0e2ed3d 100644 --- a/runhouse/resources/images/image.py +++ b/runhouse/resources/images/image.py @@ -46,7 +46,7 @@ def __init__(self, name: str, image_id: str = None): >>> rh.Image(name="base_image") >>> .setup_conda_env( >>> conda_env_name="base_env", - >>> conda_yaml={"dependencies": ["python=3.11"], "name": "base_env"}, + >>> conda_config={"dependencies": ["python=3.11"], "name": "base_env"}, >>> ) >>> .install_packages(["numpy", "pandas"]) >>> .set_env_vars({"OMP_NUM_THREADS": 1}) @@ -160,18 +160,18 @@ def run_bash(self, command: str, conda_env_name: Optional[str] = None): ) return self - def setup_conda_env(self, conda_env_name: str, conda_yaml: Union[str, Dict]): + def setup_conda_env(self, conda_env_name: str, conda_config: Union[str, Dict]): """Setup Conda env Args: conda_env_name (str): Name of conda env to create. - conda_yaml (str or Dict): Path or Dict referring to the conda yaml config to use to create the conda env. + conda_config (str or Dict): Path or Dict referring to the conda yaml config to use to create the conda env. """ self.setup_steps.append( ImageSetupStep( step_type=ImageSetupStepType.SETUP_CONDA_ENV, conda_env_name=conda_env_name, - conda_yaml=conda_yaml, + conda_config=conda_config, ) ) self.conda_env_name = conda_env_name diff --git a/runhouse/utils.py b/runhouse/utils.py index f13234a92..93a8c5e4a 100644 --- a/runhouse/utils.py +++ b/runhouse/utils.py @@ -88,7 +88,7 @@ def install_conda(cluster: "Cluster" = None, node: Optional[str] = None): def create_conda_env_on_cluster( conda_env_name: str, - conda_yaml: Dict, + conda_config: Dict, force: bool = False, cluster: "Cluster" = None, node: Optional[str] = None, @@ -114,12 +114,12 @@ def create_conda_env_on_cluster( "import yaml", "from pathlib import Path", f"path = Path('{ENVS_DIR}').expanduser()", - f"yaml.dump({conda_yaml}, open(path / '{conda_env_name}.yml', 'w'))", + f"yaml.dump({conda_config}, open(path / '{conda_env_name}.yml', 'w'))", ] ) subprocess.run(f'python -c "{python_commands}"', shell=True) else: - contents = yaml.dump(conda_yaml) + contents = yaml.dump(conda_config) run_setup_command( f"echo $'{contents}' > {yaml_path}", cluster=cluster, node=node ) diff --git a/tests/fixtures/docker_cluster_fixtures.py b/tests/fixtures/docker_cluster_fixtures.py index 1eaa51066..bf0a9f99d 100644 --- a/tests/fixtures/docker_cluster_fixtures.py +++ b/tests/fixtures/docker_cluster_fixtures.py @@ -476,7 +476,7 @@ def docker_cluster_pk_http_exposed(request, test_rns_folder): Image(name="default_image") .setup_conda_env( conda_env_name="base_env", - conda_yaml={"dependencies": ["python=3.11"], "name": "base_env"}, + conda_config={"dependencies": ["python=3.11"], "name": "base_env"}, ) .install_packages( [ diff --git a/tests/fixtures/on_demand_cluster_fixtures.py b/tests/fixtures/on_demand_cluster_fixtures.py index 37e966277..a8379eb85 100644 --- a/tests/fixtures/on_demand_cluster_fixtures.py +++ b/tests/fixtures/on_demand_cluster_fixtures.py @@ -97,7 +97,7 @@ def ondemand_gcp_cluster(request): Image(name="default_image") .setup_conda_env( conda_env_name="base_env", - conda_yaml={"dependencies": ["python=3.11"], "name": "base_env"}, + conda_config={"dependencies": ["python=3.11"], "name": "base_env"}, ) .install_packages(TEST_REQS + ["ray==2.30.0"], conda_env_name="base_env") .set_env_vars(env_vars=TEST_ENV_VARS) @@ -201,7 +201,7 @@ def multinode_cpu_docker_conda_cluster(request): .from_docker("rayproject/ray:latest-py311-cpu") .setup_conda_env( conda_env_name="base_env", - conda_yaml={"dependencies": ["python=3.11"], "name": "base_env"}, + conda_config={"dependencies": ["python=3.11"], "name": "base_env"}, ) .install_packages(TEST_REQS + ["ray==2.30.0"], conda_env_name="base_env") )