code: def stream_shuffle_generator(
      dataloader, server_idx, batch_size, shuffle_size=20000
  ):
      """
      Args:
          dataloader: iterable dataset
  
          server_idx: int
  
          batch_size: int
  
          shuffle_size: int
  
      """
      buffer_list = []
      for nodes in dataloader(server_idx):
          if len(buffer_list) < shuffle_size:
              buffer_list.extend(nodes)
          else:
              random_ids = np.random.choice(
                  len(buffer_list), size=len(nodes), replace=False
              )
              batch_nodes = [buffer_list[i] for i in random_ids]
              for ii, nid in enumerate(nodes):
                  buffer_list[random_ids[ii]] = nid
  
              yield batch_nodes
  
      if len(buffer_list) > 0:
          np.random.shuffle(buffer_list)
          start = 0
          while True:
              batch_nodes = buffer_list[start : (start + batch_size)]
              start += batch_size
              if len(batch_nodes) > 0:
                  yield batch_nodes
              else:
                  break
  
imports: import os
  import sys
  import time
  import argparse
  import warnings
  import numpy
  from functools import partial
  from paddle.framework import core
  from pgl.utils.logger import log
  from pgl.distributed import helper
label_desc: Use image node_id 1 for calling a global function with example usage: stream_shuffle_generator(dataloader, server_idx, batch_size, shuffle_size) without return types