Skip to content

Commit

Permalink
πŸ› Deal with migration errors when keep-artifacts-local is true (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
falexwolf authored May 20, 2024
1 parent a6a57e7 commit b1b7e7c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lamindb_setup/core/_settings_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path
from typing import TYPE_CHECKING, Literal

from django.db.utils import ProgrammingError
from lamin_utils import logger

from ._hub_client import call_with_fallback
Expand Down Expand Up @@ -106,8 +107,15 @@ def _search_local_root(
local_records = Storage.objects.filter(root=local_root)
else:
local_records = Storage.objects.filter(type="local")
all_local_records = local_records.all()
try:
# trigger an error in case of a migration issue
all_local_records.first()
except ProgrammingError:
logger.error("not able to load Storage registry: please migrate")
return None
found = False
for record in local_records.all():
for record in all_local_records:
root_path = Path(record.root)
if root_path.exists():
marker_path = root_path / ".lamindb/_is_initialized"
Expand Down

0 comments on commit b1b7e7c

Please sign in to comment.