Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle string system in package .to #875

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runhouse/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def _start_server(
flags.append(default_env_flag)

conda_env_flag = f" --conda-env {conda_env}" if conda_env else ""
if default_env_flag:
if conda_env_flag:
logger.info(f"Creating runtime env for conda env: {conda_env}")
flags.append(conda_env_flag)

Expand Down
16 changes: 15 additions & 1 deletion runhouse/resources/packages/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def _install(self, env: Union[str, "Env"] = None, cluster: "Cluster" = None):
path = self.install_target.path
else:
path = self.to(cluster).install_target.path
install_cmd = self._install_cmd(cluster=cluster)

if not path:
return
Expand Down Expand Up @@ -335,8 +336,21 @@ def to(
"`install_target` must be a Folder in order to copy the package to a system."
)

if (
isinstance(self.install_target.system, str)
and not self.install_target.system == "file"
):
self.install_target.system = _get_cluster_from(self.install_target.system)

install_system_name = (
self.install_target.system.name
if isinstance(self.install_target.system, Cluster)
else self.install_target.system
)
system = _get_cluster_from(system)
if self.install_target.system == system:
system_name = system.name if isinstance(system, Cluster) else system

if system_name == install_system_name:
return self

if isinstance(system, Resource):
Expand Down
4 changes: 3 additions & 1 deletion runhouse/rns/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ def set(self, key: str, value: Any, config_path: Optional[str] = None):

def set_nested(self, key: str, value: Any, config_path: Optional[str] = None):
"""Set a config key that has multiple key/value pairs"""
self.defaults_cache.setdefault(key, {}).update(value)
if not self.defaults_cache.get(key):
self.defaults_cache.setdefault(key, {})
self.defaults_cache[key].update(value)
self.save_defaults(config_path=config_path)

def set_many(self, key_value_pairs: Dict, config_path: Optional[str] = None):
Expand Down
Loading