code: def __init__(
      self,
      runner: Runner,
      worker_index: int = 0,
      enable_metrics: bool = Provide[
          BentoMLContainer.runners_config.metrics.enabled
      ],
  ) -> None:
      self.runner = runner
      self.worker_index = worker_index
      self.enable_metrics = enable_metrics
  
      self.dispatchers: dict[str, CorkDispatcher] = {}
  
      runners_config = BentoMLContainer.runners_config.get()
      traffic = runners_config.get("traffic", {}).copy()
      if runner.name in runners_config:
          traffic.update(runners_config[runner.name].get("traffic", {}))
      super().__init__(
          timeout=traffic["timeout"],
          max_concurrency=traffic["max_concurrency"],
      )
  
      def fallback():
          return ServiceUnavailable("process is overloaded")
  
      for method in runner.runner_methods:
          max_batch_size = (
              method.max_batch_size if method.config.batchable else -1
          )
          self.dispatchers[method.name] = CorkDispatcher(
              max_latency_in_ms=method.max_latency_ms,
              max_batch_size=max_batch_size,
              fallback=fallback,
          )
  
imports: from __future__ import annotations
  import functools
  import json
  import logging
  import pickle
  import traceback
  import typing
  from typing import TYPE_CHECKING
  from simple_di import Provide
  from simple_di import inject
  from bentoml.exceptions import BentoMLException
  from bentoml.exceptions import ServiceUnavailable
  from ..configuration.containers import BentoMLContainer
  from ..context import component_context
  from ..context import trace_context
  from ..marshal.dispatcher import CorkDispatcher
  from ..runner.container import AutoContainer
  from ..runner.container import Payload
  from ..runner.utils import PAYLOAD_META_HEADER
  from ..runner.utils import Params
  from ..runner.utils import payload_paramss_to_batch_params
  from ..server.base_app import BaseAppFactory
  from ..types import LazyType
  from ..utils.metrics import exponential_buckets
label_desc: Use image node_id 1 to create a new RunnerAppFactory object from inherited base classes: BaseAppFactory with example: obj = RunnerAppFactory(runner, worker_index, enable_metrics)