code: def worker(batch_info, graph, graph_wrapper, samples):
      """Worker"""
  
      def work():
          """work"""
          _graph_wrapper = copy.copy(graph_wrapper)
          _graph_wrapper.node_feat_tensor_dict = {}
          for batch_train_samples, batch_train_labels in batch_info:
              start_nodes = batch_train_samples
              nodes = start_nodes
              edges = []
              for max_deg in samples:
                  pred_nodes = graph.sample_predecessor(
                      start_nodes, max_degree=max_deg
                  )
  
                  for dst_node, src_nodes in zip(
                      start_nodes, pred_nodes
                  ):
                      for src_node in src_nodes:
                          edges.append((src_node, dst_node))
  
                  last_nodes = nodes
                  nodes = [nodes, pred_nodes]
                  nodes = flat_node_and_edge(nodes)
                  # Find new nodes
                  start_nodes = list(set(nodes) - set(last_nodes))
                  if len(start_nodes) == 0:
                      break
  
              subgraph = graph.subgraph(
                  nodes=nodes,
                  edges=edges,
                  with_node_feat=False,
                  with_edge_feat=False,
              )
  
              sub_node_index = subgraph.reindex_from_parrent_nodes(
                  batch_train_samples
              )
              feed_dict = _graph_wrapper.to_feed(subgraph)
              feed_dict["node_label"] = np.expand_dims(
                  np.array(batch_train_labels, dtype="int64"), -1
              )
              feed_dict["node_index"] = sub_node_index
              feed_dict["parent_node_index"] = np.array(
                  nodes, dtype="int64"
              )
              yield feed_dict
  
      return work
  
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 4 for calling a global function with example usage: worker(batch_info, graph, graph_wrapper, samples) and returns: work