class_docstr: BaseDataset for PGLBox.
      
docstr: This is a preload worker to generate pass dataset asynchronously
          
docstr_tok: ["This","is","a","preload","worker","to","generate","pass","dataset","asynchronously"]
code: def preload_worker(self, dataset_list):
      """This is a preload worker to generate pass dataset asynchronously"""
  
      global pass_id
      global epoch_stat
      pass_id = 0
      epoch_stat = 0
      while 1:
          dataset = None
          self.could_load_sem.acquire()
          if dataset is not None:
              dataset.wait_preload_done()
  
          if dataset is None:
              index = fleet.worker_index() * self.chunk_num
              global_chunk_num = fleet.worker_num() * self.chunk_num
  
              if dataset is None:
                  index = fleet.worker_index() * self.chunk_num
                  global_chunk_num = fleet.worker_num() * self.chunk_num
  
              dataset = self.generate_dataset(
                  self.config, index, pass_id
              )
              begin = time.time()
              dataset.load_into_memory(is_shuffle=False)
              end = time.time()
              log.info(
                  "pass[%d] STAGE [SAMPLE] finished, time cost: %f sec",
                  pass_id,
                  end - begin,
              )
              if (
                  self.config.need_dump_walk is True
                  and self.is_predict is False
              ):
                  dataset.dump_walk_path(self.config.local_dump_path)
              dataset_list.append(dataset)
              pass_id = pass_id + 1
              self.ins_ready_sem.release()
  
              # Only training has epoch finish == True.
              if not self.is_predict:
                  if paddle.distributed.get_world_size() > 1:
                      multi_node_stat = util.allreduce_min(epoch_stat)
                      if multi_node_stat == 1:
                          log.info(
                              "epoch stat is 1, will clear state and exit"
                          )
                          dataset = self.generate_dataset(
                              self.config, index, pass_id
                          )
                          dataset.clear_sample_state()
                          self.ins_ready_sem.release()
                          break
                  epoch_finish = dataset.get_epoch_finish()
                  if epoch_finish or epoch_stat == 1:
                      if paddle.distributed.get_world_size() > 1:
                          epoch_stat = 1
                          multi_node_stat = util.allreduce_min(
                              epoch_stat
                          )
                          if multi_node_stat == 1:
                              log.info(
                                  "train finished in multi node, break"
                              )
                              self.ins_ready_sem.release()
                              break
                          else:
                              log.info("other node has pass, not break")
                      else:
                          log.info("epoch_finish == true, break")
                          self.ins_ready_sem.release()
                          break
                  if (
                      self.config.max_steps > 0
                      and model_util.print_count
                      >= slef.config.max_steps
                  ):
                      log.info(
                          "reach max_steps, dataset generator break"
                      )
                      self.ins_ready_sem.release()
                      break
              else:
                  data_size = dataset.get_memory_data_size()
                  if data_size == 0:
                      log.info("infer memory data_size == 0, break")
                      self.ins_ready_sem.release()
                      break
      log.info("thread finished, pass id: %d, exit" % pass_id)
  
imports: import os
  import time
  import threading
  import traceback
  import numpy
  import paddle
  from paddle.distributed import fleet
  import paddle.fluid
  from pgl.utils.logger import log
  import util
  import helper
  from place import get_cuda_places
  import models.model_util
label_desc: Use image node_id 7 for calling the BaseDataset obj's underlying member method code with example usage: obj.preload_worker(dataset_list) without return types