class_docstr: DGL customized multiprocessing dataloader.
  
  DistDataLoader provides a similar interface to Pytorch's DataLoader to generate mini-batches
  with multiprocessing. It utilizes the worker processes created by
  :func:`dgl.distributed.initialize` to parallelize sampling.
  
  Parameters
  ----------
  dataset: a tensor
      Tensors of node IDs or edge IDs.
  batch_size: int
      The number of samples per batch to load.
  shuffle: bool, optional
      Set to ``True`` to have the data reshuffled at every epoch (default: ``False``).
  collate_fn: callable, optional
      The function is typically used to sample neighbors of the nodes in a batch
      or the endpoint nodes of the edges in a batch.
  drop_last: bool, optional
      Set to ``True`` to drop the last incomplete batch, if the dataset size is not
      divisible by the batch size. If ``False`` and the size of dataset is not divisible
      by the batch size, then the last batch will be smaller. (default: ``False``)
  queue_size: int, optional
      Size of multiprocessing queue
  
  Examples
  --------
  >>> g = dgl.distributed.DistGraph('graph-name')
  >>> def sample(seeds):
  ...     seeds = th.LongTensor(np.asarray(seeds))
  ...     frontier = dgl.distributed.sample_neighbors(g, seeds, 10)
  ...     return dgl.to_block(frontier, seeds)
  >>> dataloader = dgl.distributed.DistDataLoader(dataset=nodes, batch_size=1000,
                                                  collate_fn=sample, shuffle=True)
  >>> for block in dataloader:
  ...     feat = g.ndata['features'][block.srcdata[dgl.NID]]
  ...     labels = g.ndata['labels'][block.dstdata[dgl.NID]]
  ...     pred = model(block, feat)
  
  Note
  ----
  When performing DGL's distributed sampling with multiprocessing, users have to use this class
  instead of Pytorch's DataLoader because DGL's RPC requires that all processes establish
  connections with servers before invoking any DGL's distributed API. Therefore, this dataloader
  uses the worker processes created in :func:`dgl.distributed.initialize`.
  
  Note
  ----
  This dataloader does not guarantee the iteration order. For example,
  if dataset = [1, 2, 3, 4], batch_size = 2 and shuffle = False, the order of [1, 2]
  and [3, 4] is not guaranteed.
code: def _request_next_batch(self):
      next_data = self._next_data()
      if next_data is None:
          return
      elif self.pool is not None:
          self.pool.submit_task(self.name, next_data)
      else:
          result = self.collate_fn(next_data)
          self.queue.append(result)
      self.num_pending += 1
  
file_path: dgl/python/dgl/distributed/dist_dataloader.py
imports: from ..None import backend
  from .dist_context import get_sampler_pool
label_desc: Use image node_id 6 for calling the DistDataLoader obj's underlying member method code with example usage: obj._request_next_batch() without return types