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)
| 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): |
no test coverage detected