(self)
| 287 | raise RuntimeError(f'API Server failed to register model: {self.model_name}') |
| 288 | |
| 289 | def cleanup(self): |
| 290 | if self.api_process and self.api_process.poll() is None: |
| 291 | print(f'[API Server] Terminating for model: {self.model_path}') |
| 292 | self.api_process.terminate() |
| 293 | try: |
| 294 | self.api_process.wait(timeout=15) |
| 295 | except subprocess.TimeoutExpired: |
| 296 | self.api_process.kill() |
| 297 | if hasattr(self, '_log_file') and self._log_file and not self._log_file.closed: |
| 298 | self._log_file.close() |