Skip to content

✨ Allow registering read-only storages #965

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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 lamindb_setup/_set_managed_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from lamindb_setup.core.types import UPathStr


def set_managed_storage(root: UPathStr, **fs_kwargs):
def set_managed_storage(root: UPathStr, read_only: bool = False, **fs_kwargs):
"""Add or switch to another managed storage location.

Args:
Expand Down
5 changes: 5 additions & 0 deletions lamindb_setup/core/_settings_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
init_instance: bool = False,
created_by: UUID | None = None,
access_token: str | None = None,
read_only: bool = False,
) -> tuple[
StorageSettings,
Literal["hub-record-not-created", "hub-record-retireved", "hub-record-created"],
Expand Down Expand Up @@ -159,6 +160,10 @@
created_by=created_by,
access_token=access_token,
)
# we do not need to check that the storage is writable for read-only storages
if read_only:
return ssettings, hub_record_status

Check warning on line 165 in lamindb_setup/core/_settings_storage.py

View check run for this annotation

Codecov / codecov/patch

lamindb_setup/core/_settings_storage.py#L165

Added line #L165 was not covered by tests
# check that the storage is writable
# below comes last only if everything else was successful
try:
# (federated) credentials for AWS access are provisioned under-the-hood
Expand Down
Loading