code: def dump_dataflow_to_process_queue(df, size, nr_consumer):
      """
      Convert a DataFlow to a :class:`multiprocessing.Queue`.
      The DataFlow will only be reset in the spawned process.
  
      Args:
          df (DataFlow): the DataFlow to dump.
          size (int): size of the queue
          nr_consumer (int): number of consumer of the queue.
              The producer will add this many of ``DIE`` sentinel to the end of the queue.
  
      Returns:
          tuple(queue, process):
              The process will take data from ``df`` and fill
              the queue, once you start it. Each element in the queue is (idx,
              dp). idx can be the ``DIE`` sentinel when ``df`` is exhausted.
      """
      q = mp.Queue(size)
  
      class EnqueProc(mp.Process):
          def __init__(self, df, q, nr_consumer):
              super(EnqueProc, self).__init__()
              self.df = df
              self.q = q
  
          def run(self):
              self.df.reset_state()
              try:
                  for idx, dp in enumerate(self.df):
                      self.q.put((idx, dp))
              finally:
                  for _ in range(nr_consumer):
                      self.q.put((DIE, None))
  
      proc = EnqueProc(df, q, nr_consumer)
      return q, proc
  
file_path: tensorpack/tensorpack/dataflow/remote.py
imports: import multiprocessing
  import time
  from collections import deque
  import tqdm
  from ..utils import logger
  from ..utils.concurrency import DIE
  from ..utils.serialize import dumps, loads
  from ..utils.utils import get_tqdm_kwargs
  from .base import DataFlow, DataFlowReentrantGuard
label_desc: Use image node_id 2 for calling a global function with example usage: dump_dataflow_to_process_queue(df, size, nr_consumer) and returns: q,  proc