Skip to content

Commit

Permalink
Merge branch 'folder-as-resource' into fix-docker-folder-fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
jlewitt1 committed Aug 14, 2024
2 parents 568ca0b + 2d24c8a commit 429e61e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion runhouse/resources/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def to(
>>> local_module = rh.module(my_class)
>>> cluster_module = local_module.to("my_cluster")
"""
if system == self.system and env == self.env and not force_install:
if system == self.system and env == self.env:
if name and not self.name == name:
# TODO return duplicate object under new name, don't rename
self.rename(name)
Expand Down
3 changes: 2 additions & 1 deletion runhouse/servers/http/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,10 @@ def folder_put(
mode: str,
serialization: str,
):
serialization = serialization or "pickle"
folder_params = FolderPutParams(
path=path,
contents=contents,
contents=serialize_data(contents, serialization),
mode=mode,
overwrite=overwrite,
serialization=serialization,
Expand Down
9 changes: 7 additions & 2 deletions runhouse/servers/http/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
resolve_folder_path,
Response,
serialize_data,
deserialize_data,
ServerSettings,
)
from runhouse.servers.obj_store import (
Expand Down Expand Up @@ -677,12 +678,16 @@ async def folder_get_cmd(request: Request, get_params: FolderGetParams):
async def folder_put_cmd(request: Request, put_params: FolderPutParams):
try:
path = resolve_folder_path(put_params.path)
serialization = put_params.serialization or "pickle"
serialized_contents = put_params.contents
contents = deserialize_data(serialized_contents, serialization)

return folder_put(
path,
contents=put_params.contents,
contents=contents,
overwrite=put_params.overwrite,
mode=put_params.mode,
serialization=put_params.serialization,
serialization=serialization,
)

except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion runhouse/servers/http/http_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class FolderGetParams(FolderParams):


class FolderPutParams(FolderParams):
contents: Optional[Any]
contents: Any
overwrite: Optional[bool] = False
mode: Optional[str] = None
serialization: Optional[str] = None
Expand Down

0 comments on commit 429e61e

Please sign in to comment.