Skip to content

Commit

Permalink
🐛 Fix cache deletion on local instances
Browse files Browse the repository at this point in the history
  • Loading branch information
Koncopd committed Sep 23, 2024
1 parent 9648a18 commit e6bba54
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lamindb_setup/_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .core._hub_core import get_storage_records_for_instance
from .core._settings import settings
from .core._settings_storage import StorageSettings
from .core.upath import check_storage_is_empty
from .core.upath import LocalPathClasses, check_storage_is_empty

if TYPE_CHECKING:
from pathlib import Path
Expand All @@ -22,9 +22,11 @@

def delete_cache(isettings: InstanceSettings):
# avoid init of root
cache_dir = isettings.storage.cache_dir / isettings.storage._root_init
if cache_dir.exists():
shutil.rmtree(cache_dir)
root = isettings.storage._root_init
if not isinstance(root, LocalPathClasses):
cache_dir = isettings.storage.cache_dir / root
if cache_dir.exists():
shutil.rmtree(cache_dir)


def delete_exclusion_dir(isettings: InstanceSettings) -> None:
Expand Down

0 comments on commit e6bba54

Please sign in to comment.