code: def get_async_result(
      future_res: "mp.pool.AsyncResult[T]",
      pool: mp.Pool,
      health_check_interval: float = 1.0,
  ) -> T:
      """Wait for an AsyncResult while checking the health of the pool.
  
      If the processes of an mp.Pool die unexpectedly, the pool will respawn them
      over and over (https://bugs.python.org/issue22393). This hacky function
      (which accesses a private attribute) tries to make up for that by storing
      the initial set of processes and repeatedly polling their health.
      In Python 3.7 we can switch to concurrent.futures.ProcessPoolExecutor, where
      this issue has already been fixed (https://bugs.python.org/issue9205). We
      can't use it now because we need the mp_context and initializer arguments.
      """
      processes = list(pool._pool)
      while True:
          try:
              res = future_res.get(health_check_interval)
          except mp.TimeoutError:
              pass
          else:
              return res
          for p in processes:
              if not p.is_alive():
                  raise RuntimeError(
                      f"A subprocess exited unexpectedly with status {p.exitcode}"
                  )
  
imports: import logging
  import multiprocessing
  import multiprocessing.pool
  import os
  import os.path
  import sys
  from collections import defaultdict
  from functools import partial
  from typing import Any, Callable, Dict, Iterable, List, Mapping, MutableMapping, Optional, Set, Tuple, TypeVar, Union
  import torch
  import torch.multiprocessing
  from torch.optim import Optimizer
  from torchbiggraph.config import ConfigSchema
  from torchbiggraph.types import Bucket, EntityName, FloatTensorType, Partition, Side
label_desc: Use image node_id 14 for calling a global function with example usage: get_async_result(future_res, pool, health_check_interval) and returns: res