MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / kill_worker

Method kill_worker

tests/conftest.py:261–270  ·  view source on GitHub ↗
(self, worker_id: int, signal: int = signal.SIGTERM, wait=True)

Source from the content-addressed store, hash-verified

259 self.kill_process("server")
260
261 def kill_worker(self, worker_id: int, signal: int = signal.SIGTERM, wait=True):
262 table = self.command(["worker", "info", str(worker_id)], as_table=True)
263 pid = table.get_row_value("Process pid")
264 process = self.find_process_by_pid(int(pid))
265 if process is None:
266 raise Exception(f"Worker {worker_id} not found")
267
268 process = self.kill_process(process.name, signal=signal)
269 if wait:
270 wait_until(lambda: process.poll() is not None)
271
272 def find_process_by_pid(self, pid: int) -> Optional[ManagedProcess]:
273 for p in self.processes:

Calls 5

commandMethod · 0.95
find_process_by_pidMethod · 0.95
get_row_valueMethod · 0.80
kill_processMethod · 0.80
wait_untilFunction · 0.50

Tested by

no test coverage detected