(command, *args)
| 79 | |
| 80 | |
| 81 | def _invoke(command, *args): |
| 82 | def timeout(): |
| 83 | time.sleep(WATCHDOG_TIMEOUT) |
| 84 | if timeout.occurred is None: |
| 85 | reason = _dump_worker_log(command, "timed out") |
| 86 | timeout.occurred = reason |
| 87 | |
| 88 | timeout.occurred = None |
| 89 | timeout_thread = threading.Thread(target=timeout) |
| 90 | timeout_thread.daemon = True |
| 91 | timeout_thread.start() |
| 92 | try: |
| 93 | try: |
| 94 | _stream.write_json([command] + list(args)) |
| 95 | response = _stream.read_json() |
| 96 | assert response == ["ok"], f"{_name} {response!r}" |
| 97 | finally: |
| 98 | timeout.occurred = False |
| 99 | except Exception: |
| 100 | _dump_worker_log(command, "failed", sys.exc_info()) |
| 101 | raise |
| 102 | else: |
| 103 | assert not timeout.occurred, str(timeout.occurred) |
| 104 | |
| 105 | |
| 106 | def stop(): |
no test coverage detected
searching dependent graphs…