MCPcopy Index your code
hub / github.com/nodejs/node / _terminate

Method _terminate

deps/v8/tools/testrunner/local/pool.py:327–361  ·  view source on GitHub ↗

Terminates execution and cleans up the queues. If abort() was called before termination, this also terminates the subprocesses and doesn't wait for ongoing tests.

(self)

Source from the content-addressed store, hash-verified

325 self.os_context.terminate_process(p)
326
327 def _terminate(self):
328 """Terminates execution and cleans up the queues.
329
330 If abort() was called before termination, this also terminates the
331 subprocesses and doesn't wait for ongoing tests.
332 """
333 if self.terminated:
334 return
335 self.terminated = True
336
337 # Drain out work queue from tests
338 try:
339 while True:
340 self.work_queue.get(True, 0.1)
341 except Empty:
342 pass
343
344 # Make sure all processes stop
345 for _ in self.processes:
346 # During normal tear down the workers block on get(). Feed a poison pill
347 # per worker to make them stop.
348 self.work_queue.put("STOP")
349
350 # Send a SIGTERM to all workers. They will gracefully terminate their
351 # processing loop and if the signal is caught during job execution they
352 # will try to terminate the ongoing test processes quickly.
353 if self.abort_now:
354 self._terminate_processes()
355
356 self.notify("Joining workers")
357 with drain_queue_async(self.done_queue):
358 for p in self.processes:
359 p.join()
360
361 self.notify("Pool terminated")
362
363 def _get_result_from_queue(self):
364 """Attempts to get the next result from the queue.

Callers 1

imap_unorderedMethod · 0.95

Calls 5

_terminate_processesMethod · 0.95
drain_queue_asyncFunction · 0.85
getMethod · 0.65
putMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected