MCPcopy Index your code
hub / github.com/diffgram/diffgram / is_memory_available

Function is_memory_available

shared/utils/memory_checks.py:21–30  ·  view source on GitHub ↗
(memory_limit_float = 85.0)

Source from the content-addressed store, hash-verified

19
20
21def is_memory_available(memory_limit_float = 85.0):
22 memory_percent = get_memory_percent()
23 logger.debug(f'Checking for memory {memory_percent}%')
24 if memory_percent is None: return True # Don't stop if this check fails
25
26 if memory_percent > memory_limit_float:
27 logger.warn(f"[Memory] {memory_percent} % used is > {memory_limit_float} limit.")
28 return False
29
30 return True
31
32
33def check_and_wait_for_memory(memory_limit_float = 85.0, check_interval = 5):

Callers 1

Calls 1

get_memory_percentFunction · 0.85

Tested by

no test coverage detected