Gracefully terminate a specific worker. Args: pid: Worker process ID Returns: Dictionary with killed PID or error
(self, pid: int)
| 276 | } |
| 277 | |
| 278 | def worker_kill(self, pid: int) -> dict: |
| 279 | """ |
| 280 | Gracefully terminate a specific worker. |
| 281 | |
| 282 | Args: |
| 283 | pid: Worker process ID |
| 284 | |
| 285 | Returns: |
| 286 | Dictionary with killed PID or error |
| 287 | """ |
| 288 | pid = int(pid) |
| 289 | |
| 290 | if pid not in self.arbiter.WORKERS: |
| 291 | return { |
| 292 | "success": False, |
| 293 | "error": f"Worker {pid} not found", |
| 294 | } |
| 295 | |
| 296 | try: |
| 297 | os.kill(pid, signal.SIGTERM) |
| 298 | return { |
| 299 | "success": True, |
| 300 | "killed": pid, |
| 301 | } |
| 302 | except OSError as e: |
| 303 | return { |
| 304 | "success": False, |
| 305 | "error": str(e), |
| 306 | } |
| 307 | |
| 308 | def dirty_add(self, count: int = 1) -> dict: |
| 309 | """ |
no outgoing calls