Remove cached model directories recursively
This commit is contained in:
parent
4f603817b2
commit
6c4b33a418
2 changed files with 27 additions and 2 deletions
|
|
@ -332,7 +332,10 @@ class LargeFileBase(ABC):
|
|||
logger.info(
|
||||
f"Deleting file from cache to meet quota (max_cache_size={self.max_cache_size}): {file}"
|
||||
)
|
||||
os.unlink(file)
|
||||
if file.is_dir():
|
||||
shutil.rmtree(file)
|
||||
else:
|
||||
file.unlink()
|
||||
|
||||
@abstractmethod
|
||||
def _find_remote_instances(self) -> List[DataInstance]:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import Any, List, Optional
|
||||
|
||||
|
|
@ -80,4 +81,7 @@ class LargeFileLocal(LargeFileBase):
|
|||
logger.info(
|
||||
f"Removing old version (keep_last_n={self._keep_last_n}): {i.remote_path}"
|
||||
)
|
||||
i.remote_path.unlink()
|
||||
if i.remote_path.is_dir():
|
||||
shutil.rmtree(i.remote_path)
|
||||
else:
|
||||
i.remote_path.unlink()
|
||||
|
|
|
|||
Loading…
Reference in a new issue