| 59 | |
| 60 | |
| 61 | def _dump_worker_log(command, problem, exc_info=None): |
| 62 | reason = f"{_name}.{command}() {problem}" |
| 63 | if _worker_log_filename is None: |
| 64 | reason += ", but there is no log." |
| 65 | else: |
| 66 | try: |
| 67 | with open(_worker_log_filename) as f: |
| 68 | worker_log = f.read() |
| 69 | except Exception: |
| 70 | reason += f", but log {_worker_log_filename} could not be retrieved." |
| 71 | else: |
| 72 | reason += f"; watchdog worker process log:\n\n{worker_log}" |
| 73 | |
| 74 | if exc_info is None: |
| 75 | log.error("{0}", reason) |
| 76 | else: |
| 77 | log.swallow_exception("{0}", reason, exc_info=exc_info) |
| 78 | return reason |
| 79 | |
| 80 | |
| 81 | def _invoke(command, *args): |