\ Kill unused/idle workers
(self)
| 574 | time.sleep(0.1) |
| 575 | |
| 576 | def murder_workers(self): |
| 577 | """\ |
| 578 | Kill unused/idle workers |
| 579 | """ |
| 580 | if not self.timeout: |
| 581 | return |
| 582 | workers = list(self.WORKERS.items()) |
| 583 | for (pid, worker) in workers: |
| 584 | try: |
| 585 | if time.monotonic() - worker.tmp.last_update() <= self.timeout: |
| 586 | continue |
| 587 | except (OSError, ValueError): |
| 588 | continue |
| 589 | |
| 590 | if not worker.aborted: |
| 591 | self.log.critical("WORKER TIMEOUT (pid:%s)", pid) |
| 592 | worker.aborted = True |
| 593 | self.kill_worker(pid, signal.SIGABRT) |
| 594 | else: |
| 595 | self.kill_worker(pid, signal.SIGKILL) |
| 596 | |
| 597 | def reap_workers(self): |
| 598 | """\ |