(self, signum: int, frame: FrameType | None)
| 45 | return cls(crawler) |
| 46 | |
| 47 | def dump_stacktrace(self, signum: int, frame: FrameType | None) -> None: |
| 48 | assert self.crawler.engine |
| 49 | log_args = { |
| 50 | "stackdumps": self._thread_stacks(), |
| 51 | "enginestatus": format_engine_status(self.crawler.engine), |
| 52 | "liverefs": format_live_refs(), |
| 53 | } |
| 54 | logger.info( |
| 55 | "Dumping stack trace and engine status\n" |
| 56 | "%(enginestatus)s\n%(liverefs)s\n%(stackdumps)s", |
| 57 | log_args, |
| 58 | extra={"crawler": self.crawler}, |
| 59 | ) |
| 60 | |
| 61 | def _thread_stacks(self) -> str: |
| 62 | id2name = {th.ident: th.name for th in threading.enumerate()} |
nothing calls this directly
no test coverage detected