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

revert to synchronous contents manager, add separate async contents manager #201

Merged
merged 3 commits into from
May 31, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Move sync contents manager methods to be sync
timkpaine committed May 23, 2024
commit af914219d255127b85923cd4e6ae448cbf90bd07
27 changes: 13 additions & 14 deletions jupyterfs/metamanager.py
Original file line number Diff line number Diff line change
@@ -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):
8 changes: 8 additions & 0 deletions jupyterfs/tests/test_metamanager.py
Original file line number Diff line number Diff line change
@@ -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"