MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / can_start_operation

Method can_start_operation

resource_monitor.py:106–126  ·  view source on GitHub ↗

Check if there's enough memory to start a new operation Args: operation_name: Name of the operation for logging min_memory_mb: Minimum MB of free memory required Returns: bool: True if operation can start, False otherwise

(self, operation_name="operation", min_memory_mb=50)

Source from the content-addressed store, hash-verified

104
105 return True
106
107 def can_start_operation(self, operation_name="operation", min_memory_mb=50):
108 """
109 Check if there's enough memory to start a new operation
110
111 Args:
112 operation_name: Name of the operation for logging
113 min_memory_mb: Minimum MB of free memory required
114
115 Returns:
116 bool: True if operation can start, False otherwise
117 """
118 available_mb = self.get_available_memory_mb()
119
120 if available_mb < min_memory_mb:
121 self.logger.warning(
122 f"Cannot start {operation_name}: "
123 f"Only {available_mb:.1f}MB available, need {min_memory_mb}MB"
124 )
125 return False
126
127 return self.is_system_healthy()
128
129 def is_memory_pressure_critical(self):

Callers 3

process_alive_ipsMethod · 0.80
execute_actionMethod · 0.80

Calls 3

is_system_healthyMethod · 0.95
warningMethod · 0.80

Tested by

no test coverage detected