class_docstr: A coroutine-compatible multiprocessing.Process-alike.
  All normally blocking methods are wrapped in Tornado coroutines.
class_docstr_tok: ["A","coroutine-compatible","multiprocessing.Process-alike",".","All","normally","blocking","methods","are","wrapped","in","Tornado","coroutines","."]
code: def __init__(
      self, loop=None, target=None, name=None, args=(), kwargs=None
  ):
      kwargs = kwargs or {}
  
      if not callable(target):
          raise TypeError(
              f"`target` needs to be callable, not {type(target)!r}"
          )
      self._state = _ProcessState()
      self._loop = loop or IOLoop.current(instance=False)
  
      # _keep_child_alive is the write side of a pipe, which, when it is
      # closed, causes the read side of the pipe to unblock for reading. Note
      # that it is never closed directly. The write side is closed by the
      # kernel when our process exits, or possibly by the garbage collector
      # closing the file descriptor when the last reference to
      # _keep_child_alive goes away. We can take advantage of this fact to
      # monitor from the child and exit when the parent goes away unexpectedly
      # (for example due to SIGKILL). This variable is otherwise unused except
      # for the assignment here.
      parent_alive_pipe, self._keep_child_alive = get_mp_context().Pipe(
          duplex=False
      )
  
      self._process = get_mp_context().Process(
          target=self._run,
          name=name,
          args=(
              target,
              args,
              kwargs,
              parent_alive_pipe,
              self._keep_child_alive,
              dask.config.global_config,
          ),
      )
      self._name = self._process.name
      self._proc_finalizer = weakref.finalize(
          self, _asyncprocess_finalizer, self._process
      )
      self._watch_q = PyQueue()
      self._exit_future = Future()
      self._exit_callback = None
      self._closed = False
  
      self._start_threads()
  
imports: from __future__ import annotations
  import asyncio
  import inspect
  import logging
  import multiprocessing
  import os
  import re
  import threading
  import weakref
  from collections.abc import Callable
  from queue import Queue
  from typing import TYPE_CHECKING
  from tornado.concurrent import Future
  from tornado.ioloop import IOLoop
  import dask
  from distributed.utils import get_mp_context, wait_for
label_desc: Use image node_id 1 to create a new AsyncProcess object  with example: obj = AsyncProcess(loop, target, name, args, kwargs)