class_docstr: Object to encapsulate the code related to handle the data requests passing to executor and its returned values
class_docstr_tok: ["Object","to","encapsulate","the","code","related","to","handle","the","data","requests","passing","to","executor","and","its","returned","values"]
docstr: Determines how endpoints and method names map to batch queues. Afterwards, this method initializes the
  dynamic batching state of the request handler:
      * _batchqueue_instances of "shape" exec_endpoint_name -> parameters_key -> batch_queue
      * _batchqueue_config mapping each exec_endpoint_name to a dynamic batching configuration
docstr_tok: ["Determines","how","endpoints","and","method","names","map","to","batch","queues",".","Afterwards",",","this","method","initializes","the","dynamic","batching","state","of","the","request","handler",":","*","_batchqueue_instances","of","``","shape","''","exec_endpoint_name","-",">","parameters_key","-",">","batch_queue","*","_batchqueue_config","mapping","each","exec_endpoint_name","to","a","dynamic","batching","configuration"]
code: def _init_batchqueue_dict(self):
      """Determines how endpoints and method names map to batch queues. Afterwards, this method initializes the
      dynamic batching state of the request handler:
          * _batchqueue_instances of "shape" exec_endpoint_name -> parameters_key -> batch_queue
          * _batchqueue_config mapping each exec_endpoint_name to a dynamic batching configuration
      """
      if getattr(self._executor, "dynamic_batching", None) is not None:
          # We need to sort the keys into endpoints and functions
          # Endpoints allow specific configurations while functions allow configs to be applied to all endpoints of the function
          dbatch_endpoints = []
          dbatch_functions = []
          for (
              key,
              dbatch_config,
          ) in self._executor.dynamic_batching.items():
              if key.startswith("/"):
                  dbatch_endpoints.append((key, dbatch_config))
              else:
                  dbatch_functions.append((key, dbatch_config))
  
          # Specific endpoint configs take precedence over function configs
          for endpoint, dbatch_config in dbatch_endpoints:
              self._batchqueue_config[endpoint] = dbatch_config
  
          # Process function configs
          func_endpoints: Dict[str, List[str]] = {
              func.fn.__name__: []
              for func in self._executor.requests.values()
          }
          for endpoint, func in self._executor.requests.items():
              func_endpoints[func.fn.__name__].append(endpoint)
          for func_name, dbatch_config in dbatch_functions:
              for endpoint in func_endpoints[func_name]:
                  if endpoint not in self._batchqueue_config:
                      self._batchqueue_config[endpoint] = dbatch_config
  
          self.logger.debug(
              f"Executor Dynamic Batching configs: {self._executor.dynamic_batching}"
          )
          self.logger.debug(
              f"Endpoint Batch Queue Configs: {self._batchqueue_config}"
          )
  
          self._batchqueue_instances = {
              endpoint: {}
              for endpoint in self._batchqueue_config.keys()
          }
  
imports: import argparse
  import asyncio
  import functools
  import json
  import os
  import tempfile
  import threading
  import uuid
  import warnings
  from typing import TYPE_CHECKING, AsyncIterator, Dict, Generator, List, Optional, Tuple, Union
  from google.protobuf.struct_pb2 import Struct
  from jina._docarray import DocumentArray, docarray_v2
  from jina.constants import __default_endpoint__
  from jina.excepts import BadConfigSource, RuntimeTerminated
  from jina.helper import get_full_version
  from jina.importer import ImportExtensions
  from jina.proto import jina_pb2
  from jina.serve.executors import BaseExecutor
  from jina.serve.instrumentation import MetricsTimer
  from jina.serve.runtimes.worker.batch_queue import BatchQueue
  from jina.types.request.data import DataRequest, SingleDocumentRequest
label_desc: Use image node_id 5 for calling the WorkerRequestHandler obj's underlying member method code with example usage: obj._init_batchqueue_dict() without return types