class_docstr: The service definition is the manifestation of the Service Oriented Architecture
  and the core building block in BentoML where users define the service runtime
  architecture and model serving logic.
  
  A BentoML service is defined via instantiate this Service class. When creating a
  Service instance, user must provide a Service name and list of runners that are
  required by this Service. The instance can then be used to define InferenceAPIs via
  the `api` decorator.
class_docstr_tok: ["The","service","definition","is","the","manifestation","of","the","Service","Oriented","Architecture","and","the","core","building","block","in","BentoML","where","users","define","the","service","runtime","architecture","and","model","serving","logic",".","A","BentoML","service","is","defined","via","instantiate","this","Service","class",".","When","creating","a","Service","instance",",","user","must","provide","a","Service","name","and","list","of","runners","that","are","required","by","this","Service",".","The","instance","can","then","be","used","to","define","InferenceAPIs","via","the","`","api","`","decorator","."]
docstr: Service definition itself. Runners and models can be optionally pass into a ``bentoml.Service``.
  
  Args:
      name: name of the service
      runners: Optional list of runners to be used with this service.
      models: Optional list of ``bentoml.Model`` to be used with this service.
code: def __init__(
      self,
      name: str,
      *,
      runners: list[AbstractRunner] | None = None,
      models: list[Model] | None = None,
  ):
      """Service definition itself. Runners and models can be optionally pass into a ``bentoml.Service``.
  
      Args:
          name: name of the service
          runners: Optional list of runners to be used with this service.
          models: Optional list of ``bentoml.Model`` to be used with this service.
      """
      name = get_valid_service_name(name)
  
      # validate runners list contains Runner instances and runner names are unique
      if runners is not None:
          runner_names: t.Set[str] = set()
          for r in runners:
              assert isinstance(
                  r, AbstractRunner
              ), f'Service runners list can only contain bentoml.Runner instances, type "{type(r)}" found.'
  
              if r.name in runner_names:
                  raise ValueError(
                      f"Found duplicate name `{r.name}` in service runners."
                  )
              runner_names.add(r.name)
  
      # validate models list contains Model instances
      if models is not None:
          for model in models:
              assert isinstance(
                  model, Model
              ), f'Service models list can only contain bentoml.Model instances, type "{type(model)}" found.'
  
      self.__attrs_init__(  # type: ignore
          name=name,
          runners=[] if runners is None else runners,
          models=[] if models is None else models,
      )
  
      # Set import origin info - import_str can not be determined at this stage yet as
      # the variable name is only available in module vars after __init__ is returned
      # get_service_import_origin below will use the _caller_module for retriving the
      # correct import_str for this service
      caller_module = inspect.currentframe().f_back.f_globals[
          "__name__"
      ]
      self._caller_module = caller_module
      self._working_dir = os.getcwd()
  
imports: from __future__ import annotations
  import importlib
  import inspect
  import logging
  import os
  import sys
  import typing
  from functools import partial
  import attr
  from bentoml.exceptions import BentoMLException
  from ...exceptions import NotFound
  from ...grpc.utils import LATEST_PROTOCOL_VERSION
  from ...grpc.utils import import_grpc
  from ..bento.bento import get_default_svc_readme
  from ..context import ServiceContext
  from ..io_descriptors import IODescriptor
  from ..io_descriptors.base import IOType
  from ..models import Model
  from ..runner.runner import AbstractRunner
  from ..runner.runner import Runner
  from ..tag import Tag
  from ..utils import first_not_none
  from .inference_api import InferenceAPI
label_desc: Use image node_id 2 to create a new Service object  with example: obj = Service(name)