Skip to content
Open
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
12 changes: 12 additions & 0 deletions openml/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,18 @@ def safe_func(*args: P.args, **kwargs: P.kwargs) -> R:
return func


def get_cache_size() -> int:
"""Calculate the size of OpenML cache directory

Returns
-------
cache_size: int
Total size of cache in bytes
"""
path = Path(config.get_cache_directory())
return sum(f.stat().st_size for f in path.rglob("*") if f.is_file())


def _create_lockfiles_dir() -> Path:
path = Path(config.get_cache_directory()) / "locks"
# TODO(eddiebergman): Not sure why this is allowed to error and ignore???
Expand Down