class_docstr: Customized worker pool
class_docstr_tok: ["Customized","worker","pool"]
docstr: Customized worker pool init function
docstr_tok: ["Customized","worker","pool","init","function"]
code: def __init__(self, num_workers, rpc_config):
      """
      Customized worker pool init function
      """
      ctx = mp.get_context("spawn")
      self.num_workers = num_workers
      # As pool could be used by any number of dataloaders, queues
      # should be able to take infinite elements to avoid dead lock.
      self.queue_size = 0
      self.result_queue = ctx.Queue(self.queue_size)
      self.results = (
          {}
      )  # key is dataloader name, value is fetched batch.
      self.task_queues = []
      self.process_list = []
      self.current_proc_id = 0
      self.cache_result_dict = {}
      self.barrier = ctx.Barrier(num_workers)
      for _ in range(num_workers):
          task_queue = ctx.Queue(self.queue_size)
          self.task_queues.append(task_queue)
          proc = ctx.Process(
              target=init_process,
              args=(
                  rpc_config,
                  (self.result_queue, task_queue, self.barrier),
              ),
          )
          proc.daemon = True
          proc.start()
          self.process_list.append(proc)
  
imports: import atexit
  import gc
  import multiprocessing
  import os
  import queue
  import sys
  import time
  import traceback
  from enum import Enum
  from ..None import utils
  from ..base import dgl_warning, DGLError
  from .None import rpc
  from .constants import MAX_QUEUE_SIZE
  from .kvstore import close_kvstore, init_kvstore
  from .role import init_role
  from .rpc_client import connect_to_server
label_desc: Use image node_id 1 to create a new CustomPool object  with example: obj = CustomPool(num_workers, rpc_config)