Skip to content

Commit

Permalink
read /proc/meminfo in utils/system.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yocalebo committed Dec 28, 2024
1 parent aacef06 commit 36e4608
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scale_build/utils/system.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import psutil
from functools import cache

REQUIRED_RAM_GB = 16 * (1024 ** 3)

REQUIRED_RAM = 16 # GB
__all__ = ("has_low_ram",)


@cache
def has_low_ram():
return psutil.virtual_memory().total < REQUIRED_RAM * 1024 * 1024 * 1024
with open('/proc/meminfo') as f:
for line in filter(lambda x: 'MemTotal' in x, f):
return int(line.split()[1]) * 1024 < REQUIRED_RAM_GB

0 comments on commit 36e4608

Please sign in to comment.