code: def multiprocess_graph_reader(
      graph,
      graph_wrapper,
      samples,
      node_index,
      batch_size,
      node_label,
      with_parent_node_index=False,
      num_workers=4,
  ):
      """multiprocess_graph_reader"""
  
      def parse_to_subgraph(
          rd, prefix, node_feat, _with_parent_node_index
      ):
          """parse_to_subgraph"""
  
          def work():
              """work"""
              for data in rd():
                  feed_dict = data
                  for key in node_feat:
                      feed_dict[
                          prefix + "/node_feat/" + key
                      ] = node_feat[key][feed_dict["parent_node_index"]]
                  if not _with_parent_node_index:
                      del feed_dict["parent_node_index"]
                  yield feed_dict
  
          return work
  
      def reader():
          """reader"""
          batch_info = list(
              node_batch_iter(
                  node_index, node_label, batch_size=batch_size
              )
          )
          block_size = int(len(batch_info) / num_workers + 1)
          reader_pool = []
          for i in range(num_workers):
              reader_pool.append(
                  worker(
                      batch_info[block_size * i : block_size * (i + 1)],
                      graph,
                      graph_wrapper,
                      samples,
                  )
              )
  
          if len(reader_pool) == 1:
              r = parse_to_subgraph(
                  reader_pool[0],
                  repr(graph_wrapper),
                  graph.node_feat,
                  with_parent_node_index,
              )
          else:
              multi_process_sample = mp_reader.multiprocess_reader(
                  reader_pool, use_pipe=True, queue_size=1000
              )
              r = parse_to_subgraph(
                  multi_process_sample,
                  repr(graph_wrapper),
                  graph.node_feat,
                  with_parent_node_index,
              )
          return paddle.reader.buffered(r, num_workers)
  
      return reader()
  
file_path: PGL/legacy/examples/graphsage/reader.py
imports: import numpy
  import pickle
  import paddle
  import paddle.fluid
  import pgl
  import time
  from pgl.utils import mp_reader
  from pgl.utils.logger import log
  import time
  import copy
label_desc: Use image node_id 5 for calling a global function with example usage: multiprocess_graph_reader(graph, graph_wrapper, samples, node_index, batch_size, node_label, with_parent_node_index, num_workers) and returns: reader, work, paddle