def _parent_process(child_pipe): """Simulate starting an AsyncProcess and then dying. The child_alive pipe is held open for as long as the child is alive, and can be used to determine if it exited correctly.""" async def parent_process_coroutine(): worker_ready = mp_context.Event() worker = AsyncProcess(target=_worker_process, args=(worker_ready, child_pipe)) await worker.start() # Wait for the child process to have started. worker_ready.wait() # Exit immediately, without doing any process teardown (including atexit # and 'finally:' blocks) as if by SIGKILL. This should cause # worker_process to also exit. os._exit(255) with pristine_loop() as loop: try: loop.run_sync(parent_process_coroutine, timeout=10) finally: loop.stop() raise RuntimeError("this should be unreachable due to os._exit")
def _parent_process(child_pipe): """ Simulate starting an AsyncProcess and then dying. The child_alive pipe is held open for as long as the child is alive, and can be used to determine if it exited correctly. """ def parent_process_coroutine(): worker_ready = mp_context.Event() worker = AsyncProcess(target=_worker_process, args=(worker_ready, child_pipe)) yield worker.start() # Wait for the child process to have started. worker_ready.wait() # Exit immediately, without doing any process teardown (including atexit # and 'finally:' blocks) as if by SIGKILL. This should cause # worker_process to also exit. os._exit(255) with pristine_loop() as loop: try: loop.run_sync(gen.coroutine(parent_process_coroutine), timeout=10) finally: loop.stop() raise RuntimeError("this should be unreachable due to os._exit")