Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEEP-112] force cleanup is RAM is filled more than 90% #2835

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion deeplake/core/storage/lru_cache.py
Expand Up @@ -4,6 +4,7 @@
from deeplake.core.storage.deeplake_memory_object import DeepLakeMemoryObject
from deeplake.core.chunk.base_chunk import BaseChunk
from typing import Any, Dict, Optional, Union
import psutil

from deeplake.core.storage.provider import StorageProvider
import time
Expand Down Expand Up @@ -415,7 +416,10 @@ def _free_up_space(self, extra_size: int):
Args:
extra_size (int): the space that needs is required in bytes.
"""
while self.cache_used > 0 and extra_size + self.cache_used > self.cache_size:
while self.cache_used > 0 and (
extra_size + self.cache_used > self.cache_size
or psutil.virtual_memory().percent > 90
):
self._pop_from_cache()

def _pop_from_cache(self):
Expand Down
1 change: 1 addition & 0 deletions deeplake/requirements/common.txt
Expand Up @@ -24,3 +24,4 @@ azure-cli
azure-identity
azure-storage-blob
pydantic
psutil
1 change: 1 addition & 0 deletions deeplake/requirements/plugins.txt
Expand Up @@ -10,3 +10,4 @@ mmcv-full==1.7.1; platform_system == "Linux" and python_version >= "3.7"
mmdet==2.28.1; platform_system == "Linux" and python_version >= "3.7"
mmengine
pandas
types-psutil