Skip to content

Commit

Permalink
Move sync contents manager methods to be sync
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed May 23, 2024
1 parent 3f86488 commit af91421
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
27 changes: 13 additions & 14 deletions jupyterfs/metamanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,31 +147,30 @@ def root_manager(self):
def root_dir(self):
return self.root_manager.root_dir

is_hidden = path_first_arg("is_hidden", False)
dir_exists = path_first_arg("dir_exists", False)
file_exists = path_kwarg("file_exists", "", False)
exists = path_first_arg("exists", False)
is_hidden = path_first_arg("is_hidden", False, sync=True)
dir_exists = path_first_arg("dir_exists", False, sync=True)
file_exists = path_kwarg("file_exists", "", False, sync=True)
exists = path_first_arg("exists", False, sync=False)

save = path_second_arg("save", "model", True, sync=False)
rename = path_old_new("rename", False, sync=False)
save = path_second_arg("save", "model", True, sync=True)
rename = path_old_new("rename", False, sync=True)

get = path_first_arg("get", True, sync=False)
delete = path_first_arg("delete", False, sync=False)
get = path_first_arg("get", True, sync=True)
delete = path_first_arg("delete", False, sync=True)

get_kernel_path = path_first_arg("get_kernel_path", False, sync=True)

create_checkpoint = path_first_arg("create_checkpoint", False, sync=False)
list_checkpoints = path_first_arg("list_checkpoints", False, sync=False)
create_checkpoint = path_first_arg("create_checkpoint", False, sync=True)
list_checkpoints = path_first_arg("list_checkpoints", False, sync=True)
restore_checkpoint = path_second_arg(
"restore_checkpoint", "checkpoint_id", False, sync=False
"restore_checkpoint", "checkpoint_id", False, sync=True
)
delete_checkpoint = path_second_arg(
"delete_checkpoint", "checkpoint_id", False, sync=False
"delete_checkpoint", "checkpoint_id", False, sync=True
)


class SyncMetaManager(MetaManagerShared, ContentsManager):
...
class SyncMetaManager(MetaManagerShared, ContentsManager): ...


class MetaManager(MetaManagerShared, AsyncContentsManager):
Expand Down
8 changes: 8 additions & 0 deletions jupyterfs/tests/test_metamanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,11 @@ async def test_resource_validators_no_auth(tmp_path, jp_fetch, jp_server_config)
)
names = set(map(lambda r: r["name"], resources))
assert names == {"valid-1", "valid-2"}


@pytest.mark.parametrize("base_config", [base_config, sync_base_config])
@pytest.mark.parametrize("our_config", [{}])
async def test_basic_sanity_check(tmp_path, jp_fetch, jp_server_config):
cc = ContentsClient(jp_fetch)
resources = await cc.get("/")
assert resources["type"] == "directory"

0 comments on commit af91421

Please sign in to comment.