diff --git a/src/_bentoml_impl/client/http.py b/src/_bentoml_impl/client/http.py index 729a0f75c10..7e99eb2712b 100644 --- a/src/_bentoml_impl/client/http.py +++ b/src/_bentoml_impl/client/http.py @@ -145,14 +145,14 @@ def __init__( stream_output=method.is_stream, ) - from bentoml._internal.context import component_context + from bentoml._internal.context import server_context const_headers = { - "Bento-Name": component_context.bento_name, - "Bento-Version": component_context.bento_version, + "Bento-Name": server_context.bento_name, + "Bento-Version": server_context.bento_version, "Runner-Name": service.name, - "Yatai-Bento-Deployment-Name": component_context.yatai_bento_deployment_name, - "Yatai-Bento-Deployment-Namespace": component_context.yatai_bento_deployment_namespace, + "Yatai-Bento-Deployment-Name": server_context.yatai_bento_deployment_name, + "Yatai-Bento-Deployment-Namespace": server_context.yatai_bento_deployment_namespace, } self.__attrs_init__( # type: ignore url=url, diff --git a/src/_bentoml_impl/server/app.py b/src/_bentoml_impl/server/app.py index 127d98912de..a482e57346f 100644 --- a/src/_bentoml_impl/server/app.py +++ b/src/_bentoml_impl/server/app.py @@ -370,17 +370,17 @@ async def batch_infer( async def inner_infer( batches: t.Sequence[t.Any], **kwargs: t.Any ) -> t.Sequence[t.Any]: - from bentoml._internal.context import component_context + from bentoml._internal.context import server_context from bentoml._internal.runner.container import AutoContainer from bentoml._internal.utils import is_async_callable if self.enable_metrics: self.adaptive_batch_size_hist.labels( # type: ignore runner_name=self.service.name, - worker_index=component_context.component_index, + worker_index=server_context.worker_index, method_name=name, - service_version=component_context.bento_version, - service_name=component_context.bento_name, + service_version=server_context.bento_version, + service_name=server_context.bento_name, ).observe(len(batches)) if len(batches) == 0: diff --git a/src/_bentoml_impl/worker/service.py b/src/_bentoml_impl/worker/service.py index 7096606181c..2c73f8957f9 100644 --- a/src/_bentoml_impl/worker/service.py +++ b/src/_bentoml_impl/worker/service.py @@ -134,7 +134,7 @@ def main( from _bentoml_impl.loader import import_service from bentoml._internal.container import BentoMLContainer - from bentoml._internal.context import component_context + from bentoml._internal.context import server_context from bentoml._internal.log import configure_server_logging from ..server.app import ServiceAppFactory @@ -149,22 +149,22 @@ def main( if service_name and service_name != service.name: service = service.find_dependent(service_name) - component_context.component_type = "service" + server_context.service_type = "service" else: - component_context.component_type = "entry_service" + server_context.service_type = "entry_service" if worker_id is not None: - component_context.component_index = worker_id + server_context.worker_index = worker_id configure_server_logging() BentoMLContainer.development_mode.set(development_mode) if prometheus_dir is not None: BentoMLContainer.prometheus_multiproc_dir.set(prometheus_dir) - component_context.component_name = service.name + server_context.service_name = service.name asgi_app = ServiceAppFactory( - service, is_main=component_context.component_type == "entry_service" + service, is_main=server_context.service_type == "entry_service" )() uvicorn_extra_options: dict[str, t.Any] = {} diff --git a/src/bentoml/__init__.py b/src/bentoml/__init__.py index c1f4634aa70..931f1f01a54 100644 --- a/src/bentoml/__init__.py +++ b/src/bentoml/__init__.py @@ -31,7 +31,7 @@ from ._internal.bento import Bento from ._internal.cloud import YataiClient from ._internal.context import ServiceContext as Context -from ._internal.context import component_context +from ._internal.context import server_context from ._internal.models import Model from ._internal.monitoring import monitor from ._internal.resource import Resource @@ -216,7 +216,7 @@ def __getattr__(name: str) -> Any: "batch", "metrics", "container", - "component_context", + "server_context", "client", "server", "io", diff --git a/src/bentoml/_internal/configuration/containers.py b/src/bentoml/_internal/configuration/containers.py index 337cea3b10f..bbac6a36e7c 100644 --- a/src/bentoml/_internal/configuration/containers.py +++ b/src/bentoml/_internal/configuration/containers.py @@ -16,7 +16,7 @@ from simple_di import providers from ...exceptions import BentoMLConfigException -from ..context import component_context +from ..context import server_context from ..context import trace_context from ..resource import CpuResource from ..utils import split_with_quotes @@ -362,14 +362,14 @@ def tracer_provider( system_otel_resources: Resource = OTELResourceDetector().detect() _resource = {} - if component_context.component_name: - _resource[SERVICE_NAME] = component_context.component_name - if component_context.component_index: - _resource[SERVICE_INSTANCE_ID] = component_context.component_index - if component_context.bento_name: - _resource[SERVICE_NAMESPACE] = component_context.bento_name - if component_context.bento_version: - _resource[SERVICE_VERSION] = component_context.bento_version + if server_context.service_name: + _resource[SERVICE_NAME] = server_context.service_name + if server_context.worker_index: + _resource[SERVICE_INSTANCE_ID] = server_context.worker_index + if server_context.bento_name: + _resource[SERVICE_NAMESPACE] = server_context.bento_name + if server_context.bento_version: + _resource[SERVICE_VERSION] = server_context.bento_version bentoml_resource = Resource.create(_resource) diff --git a/src/bentoml/_internal/context.py b/src/bentoml/_internal/context.py index 418fcca75c5..c6f7d74eb8e 100644 --- a/src/bentoml/_internal/context.py +++ b/src/bentoml/_internal/context.py @@ -213,12 +213,25 @@ def service_name(self, service_name: t.Optional[str]) -> None: self._service_name_var.set(service_name) +@attr.define class _ComponentContext: bento_name: str = "" bento_version: str = "not available" - component_type: str | None = None - component_name: str | None = None - component_index: int | None = None + service_type: str | None = None + service_name: str | None = None + worker_index: int | None = None + + @property + def component_type(self) -> str | None: + return self.service_type + + @property + def component_name(self) -> str | None: + return self.service_name + + @property + def component_index(self) -> int | None: + return self.worker_index @property def yatai_bento_deployment_name(self) -> str: @@ -230,4 +243,4 @@ def yatai_bento_deployment_namespace(self) -> str: trace_context = _ServiceTraceContext() -component_context = _ComponentContext() +server_context = component_context = _ComponentContext() diff --git a/src/bentoml/_internal/log.py b/src/bentoml/_internal/log.py index 9e002d3c541..57b1545b4d0 100644 --- a/src/bentoml/_internal/log.py +++ b/src/bentoml/_internal/log.py @@ -8,7 +8,7 @@ from .configuration import get_debug_mode from .configuration import get_quiet_mode -from .context import component_context +from .context import server_context from .context import trace_context @@ -127,12 +127,12 @@ def configure_logging(): @lru_cache(maxsize=1) def _component_name(): result = "" - if component_context.component_type: - result = component_context.component_type - if component_context.component_name: - result = f"{result}:{component_context.component_name}" - if component_context.component_index: - result = f"{result}:{component_context.component_index}" + if server_context.service_type: + result = server_context.service_type + if server_context.service_name: + result = f"{result}:{server_context.service_name}" + if server_context.worker_index: + result = f"{result}:{server_context.worker_index}" return result diff --git a/src/bentoml/_internal/monitoring/default.py b/src/bentoml/_internal/monitoring/default.py index 8979046a17d..c6f3c6230bd 100644 --- a/src/bentoml/_internal/monitoring/default.py +++ b/src/bentoml/_internal/monitoring/default.py @@ -9,7 +9,7 @@ import yaml -from ..context import component_context +from ..context import server_context from ..context import trace_context from .base import MonitorBase @@ -78,7 +78,7 @@ def _init_logger(self) -> None: with open(self.log_config_file, "r", encoding="utf8") as f: logging_config_yaml = f.read() - worker_id = component_context.component_index or 0 + worker_id = server_context.worker_index or 0 schema_path = Path(self.log_path).joinpath( self.name, "schema", f"schema.{worker_id}.log" ) @@ -118,8 +118,8 @@ def export_schema(self, columns_schema: dict[str, dict[str, str]]) -> None: self.schema_logger.info( dict( meta_data={ - "bento_name": component_context.bento_name, - "bento_version": component_context.bento_version, + "bento_name": server_context.bento_name, + "bento_version": server_context.bento_version, }, columns=list(columns_schema.values()), ) diff --git a/src/bentoml/_internal/monitoring/otlp.py b/src/bentoml/_internal/monitoring/otlp.py index 7800ee2c390..dae1a627d33 100644 --- a/src/bentoml/_internal/monitoring/otlp.py +++ b/src/bentoml/_internal/monitoring/otlp.py @@ -22,7 +22,7 @@ from opentelemetry.sdk.resources import Resource from ...exceptions import MissingDependencyException -from ..context import component_context +from ..context import server_context from ..context import trace_context from .base import MonitorBase @@ -143,10 +143,10 @@ def _init_logger(self) -> None: # configure resource if user has not explicitly configured it. system_otel_resources: Resource = OTELResourceDetector().detect() _resource = {} - if component_context.bento_name: - _resource[SERVICE_NAME] = f"{component_context.bento_name}:{self.name}" - if component_context.bento_version: - _resource[SERVICE_INSTANCE_ID] = component_context.bento_version + if server_context.bento_name: + _resource[SERVICE_NAME] = f"{server_context.bento_name}:{self.name}" + if server_context.bento_version: + _resource[SERVICE_INSTANCE_ID] = server_context.bento_version bentoml_resource = Resource.create(_resource) @@ -216,8 +216,8 @@ def export_data( self.COLUMN_TIME: datetime.datetime.now().timestamp(), self.COLUMN_RID: str(trace_context.request_id), self.COLUMN_META: { - "bento_name": component_context.bento_name, - "bento_version": component_context.bento_version, + "bento_name": server_context.bento_name, + "bento_version": server_context.bento_version, "monitor_name": self.name, "schema": self._schema, }, diff --git a/src/bentoml/_internal/runner/runner_handle/remote.py b/src/bentoml/_internal/runner/runner_handle/remote.py index 85b3e1d44a8..1755fd67baa 100644 --- a/src/bentoml/_internal/runner/runner_handle/remote.py +++ b/src/bentoml/_internal/runner/runner_handle/remote.py @@ -15,7 +15,7 @@ from ....exceptions import RemoteException from ....exceptions import ServiceUnavailable from ...configuration.containers import BentoMLContainer -from ...context import component_context +from ...context import server_context from ...utils import LazyLoader from ...utils.uri import uri_to_path from ..container import Payload @@ -172,11 +172,11 @@ async def async_run_method( inp_batch_dim = __bentoml_method.config.batch_dim[0] headers = { - "Bento-Name": component_context.bento_name, - "Bento-Version": component_context.bento_version, + "Bento-Name": server_context.bento_name, + "Bento-Version": server_context.bento_version, "Runner-Name": self._runner.name, - "Yatai-Bento-Deployment-Name": component_context.yatai_bento_deployment_name, - "Yatai-Bento-Deployment-Namespace": component_context.yatai_bento_deployment_namespace, + "Yatai-Bento-Deployment-Name": server_context.yatai_bento_deployment_name, + "Yatai-Bento-Deployment-Namespace": server_context.yatai_bento_deployment_namespace, } total_args_num = len(args) + len(kwargs) headers["Args-Number"] = str(total_args_num) @@ -287,11 +287,11 @@ async def async_stream_method( inp_batch_dim = __bentoml_method.config.batch_dim[0] headers = { - "Bento-Name": component_context.bento_name, - "Bento-Version": component_context.bento_version, + "Bento-Name": server_context.bento_name, + "Bento-Version": server_context.bento_version, "Runner-Name": self._runner.name, - "Yatai-Bento-Deployment-Name": component_context.yatai_bento_deployment_name, - "Yatai-Bento-Deployment-Namespace": component_context.yatai_bento_deployment_namespace, + "Yatai-Bento-Deployment-Name": server_context.yatai_bento_deployment_name, + "Yatai-Bento-Deployment-Namespace": server_context.yatai_bento_deployment_namespace, } total_args_num = len(args) + len(kwargs) headers["Args-Number"] = str(total_args_num) @@ -360,11 +360,11 @@ async def is_ready(self, timeout: int) -> bool: async with self._client.get( f"{self._addr}/readyz", headers={ - "Bento-Name": component_context.bento_name, - "Bento-Version": component_context.bento_version, + "Bento-Name": server_context.bento_name, + "Bento-Version": server_context.bento_version, "Runner-Name": self._runner.name, - "Yatai-Bento-Deployment-Name": component_context.yatai_bento_deployment_name, - "Yatai-Bento-Deployment-Namespace": component_context.yatai_bento_deployment_namespace, + "Yatai-Bento-Deployment-Name": server_context.yatai_bento_deployment_name, + "Yatai-Bento-Deployment-Namespace": server_context.yatai_bento_deployment_namespace, }, timeout=aio_timeout, ) as resp: diff --git a/src/bentoml/_internal/server/http/instruments.py b/src/bentoml/_internal/server/http/instruments.py index a55d9cfc576..eb1927681ac 100644 --- a/src/bentoml/_internal/server/http/instruments.py +++ b/src/bentoml/_internal/server/http/instruments.py @@ -9,7 +9,7 @@ from simple_di import inject from ...configuration.containers import BentoMLContainer -from ...context import component_context +from ...context import server_context if TYPE_CHECKING: from ... import external_typing as ext @@ -109,8 +109,8 @@ async def wrapped_send(message: "ext.ASGIMessage") -> None: # instrument request total count self.metrics_request_total.labels( endpoint=endpoint, - service_name=component_context.bento_name, - service_version=component_context.bento_version, + service_name=server_context.bento_name, + service_version=server_context.bento_version, http_response_code=STATUS_VAR.get(), ).inc() @@ -118,8 +118,8 @@ async def wrapped_send(message: "ext.ASGIMessage") -> None: total_time = max(default_timer() - START_TIME_VAR.get(), 0) self.metrics_request_duration.labels( # type: ignore endpoint=endpoint, - service_name=component_context.bento_name, - service_version=component_context.bento_version, + service_name=server_context.bento_name, + service_version=server_context.bento_version, http_response_code=STATUS_VAR.get(), ).observe(total_time) @@ -129,8 +129,8 @@ async def wrapped_send(message: "ext.ASGIMessage") -> None: with self.metrics_request_in_progress.labels( endpoint=endpoint, - service_name=component_context.bento_name, - service_version=component_context.bento_version, + service_name=server_context.bento_name, + service_version=server_context.bento_version, ).track_inprogress(): await self.app(scope, receive, wrapped_send) return @@ -223,20 +223,20 @@ async def wrapped_send(message: "ext.ASGIMessage") -> None: # instrument request total count self.metrics_request_total.labels( endpoint=endpoint, - service_name=component_context.bento_name, - service_version=component_context.bento_version, + service_name=server_context.bento_name, + service_version=server_context.bento_version, http_response_code=STATUS_VAR.get(), - runner_name=component_context.component_name, + runner_name=server_context.service_name, ).inc() # instrument request duration total_time = max(default_timer() - START_TIME_VAR.get(), 0) self.metrics_request_duration.labels( # type: ignore endpoint=endpoint, - service_name=component_context.bento_name, - service_version=component_context.bento_version, + service_name=server_context.bento_name, + service_version=server_context.bento_version, http_response_code=STATUS_VAR.get(), - runner_name=component_context.component_name, + runner_name=server_context.service_name, ).observe(total_time) START_TIME_VAR.set(0) @@ -245,9 +245,9 @@ async def wrapped_send(message: "ext.ASGIMessage") -> None: with self.metrics_request_in_progress.labels( endpoint=endpoint, - service_name=component_context.bento_name, - service_version=component_context.bento_version, - runner_name=component_context.component_name, + service_name=server_context.bento_name, + service_version=server_context.bento_version, + runner_name=server_context.service_name, ).track_inprogress(): await self.app(scope, receive, wrapped_send) return diff --git a/src/bentoml/_internal/server/runner_app.py b/src/bentoml/_internal/server/runner_app.py index b8023ca87af..ee6a0cce034 100644 --- a/src/bentoml/_internal/server/runner_app.py +++ b/src/bentoml/_internal/server/runner_app.py @@ -15,7 +15,7 @@ from bentoml.exceptions import ServiceUnavailable from ..configuration.containers import BentoMLContainer -from ..context import component_context +from ..context import server_context from ..context import trace_context from ..marshal.dispatcher import CorkDispatcher from ..runner.container import AutoContainer @@ -227,8 +227,8 @@ async def infer_batch( runner_name=self.runner.name, worker_index=self.worker_index, method_name=runner_method.name, - service_version=component_context.bento_version, - service_name=component_context.bento_name, + service_version=server_context.bento_version, + service_name=server_context.bento_name, ).observe(len(params_list)) if not params_list: diff --git a/src/bentoml/_internal/utils/circus/watchfilesplugin.py b/src/bentoml/_internal/utils/circus/watchfilesplugin.py index 81b0073a63c..149e42b7180 100644 --- a/src/bentoml/_internal/utils/circus/watchfilesplugin.py +++ b/src/bentoml/_internal/utils/circus/watchfilesplugin.py @@ -15,7 +15,7 @@ from ...bento.build_config import BentoBuildConfig from ...bento.build_config import BentoPathSpec from ...configuration import is_pypi_installed_bentoml -from ...context import component_context +from ...context import server_context from ...log import configure_server_logging from ...utils.pkg import source_locations @@ -34,7 +34,7 @@ def __init__(self, *args: t.Any, **config: t.Any): assert "working_dir" in config, "`working_dir` is required" configure_server_logging() - component_context.component_type = "observer" + server_context.service_type = "observer" super().__init__(*args, **config) diff --git a/src/bentoml/grpc/interceptors/prometheus.py b/src/bentoml/grpc/interceptors/prometheus.py index 75306f53ed1..54ce2d8a51a 100644 --- a/src/bentoml/grpc/interceptors/prometheus.py +++ b/src/bentoml/grpc/interceptors/prometheus.py @@ -11,7 +11,7 @@ from simple_di import inject from bentoml._internal.configuration.containers import BentoMLContainer -from bentoml._internal.context import component_context +from bentoml._internal.context import server_context from bentoml.grpc.utils import import_generated_stubs from bentoml.grpc.utils import import_grpc from bentoml.grpc.utils import to_http_status @@ -116,8 +116,8 @@ async def new_behaviour( # instrument request total count self.metrics_request_total.labels( api_name=api_name, - service_name=component_context.bento_name, - service_version=component_context.bento_version, + service_name=server_context.bento_name, + service_version=server_context.bento_version, http_response_code=to_http_status( t.cast(grpc.StatusCode, context.code()) ), @@ -128,20 +128,18 @@ async def new_behaviour( total_time = max(default_timer() - START_TIME_VAR.get(), 0) self.metrics_request_duration.labels( # type: ignore (unfinished prometheus types) api_name=api_name, - service_name=component_context.bento_name, - service_version=component_context.bento_version, + service_name=server_context.bento_name, + service_version=server_context.bento_version, http_response_code=to_http_status( t.cast(grpc.StatusCode, context.code()) ), - ).observe( - total_time - ) + ).observe(total_time) START_TIME_VAR.set(0) # instrument request in progress with self.metrics_request_in_progress.labels( api_name=api_name, - service_version=component_context.bento_version, - service_name=component_context.bento_name, + service_version=server_context.bento_version, + service_name=server_context.bento_name, ).track_inprogress(): response = await behaviour(request, context) return response diff --git a/src/bentoml_cli/cli.py b/src/bentoml_cli/cli.py index b3894858541..91a598e3107 100644 --- a/src/bentoml_cli/cli.py +++ b/src/bentoml_cli/cli.py @@ -7,7 +7,7 @@ def create_bentoml_cli() -> click.Command: - from bentoml._internal.context import component_context + from bentoml._internal.context import server_context from bentoml_cli.bentos import bento_command from bentoml_cli.cloud import cloud_command from bentoml_cli.containerize import containerize_command @@ -19,7 +19,7 @@ def create_bentoml_cli() -> click.Command: from bentoml_cli.start import start_command from bentoml_cli.utils import BentoMLCommandGroup - component_context.component_type = "cli" + server_context.service_type = "cli" CONTEXT_SETTINGS = {"help_option_names": ("-h", "--help")} diff --git a/src/bentoml_cli/worker/grpc_api_server.py b/src/bentoml_cli/worker/grpc_api_server.py index 660e0ba46f4..1610fc594f1 100644 --- a/src/bentoml_cli/worker/grpc_api_server.py +++ b/src/bentoml_cli/worker/grpc_api_server.py @@ -110,11 +110,11 @@ def main( import bentoml from bentoml._internal.configuration.containers import BentoMLContainer - from bentoml._internal.context import component_context + from bentoml._internal.context import server_context from bentoml._internal.log import configure_server_logging - component_context.component_type = "grpc_api_server" - component_context.component_index = worker_id + server_context.service_type = "grpc_api_server" + server_context.worker_index = worker_id configure_server_logging() if worker_id is None: @@ -135,13 +135,13 @@ def main( host = BentoMLContainer.grpc.host.get() # setup context - component_context.component_name = svc.name + server_context.service_name = svc.name if svc.tag is None: - component_context.bento_name = svc.name - component_context.bento_version = "not available" + server_context.bento_name = svc.name + server_context.bento_version = "not available" else: - component_context.bento_name = svc.tag.name - component_context.bento_version = svc.tag.version or "not available" + server_context.bento_name = svc.tag.name + server_context.bento_version = svc.tag.version or "not available" from bentoml._internal.server import grpc_app as grpc diff --git a/src/bentoml_cli/worker/grpc_prometheus_server.py b/src/bentoml_cli/worker/grpc_prometheus_server.py index 52bce7de69f..9c1a358aec2 100644 --- a/src/bentoml_cli/worker/grpc_prometheus_server.py +++ b/src/bentoml_cli/worker/grpc_prometheus_server.py @@ -57,10 +57,10 @@ def main(fd: int, backlog: int, prometheus_dir: str | None): from bentoml._internal.configuration import get_debug_mode from bentoml._internal.configuration.containers import BentoMLContainer - from bentoml._internal.context import component_context + from bentoml._internal.context import server_context from bentoml._internal.log import configure_server_logging - component_context.component_type = "prom_server" + server_context.service_type = "prom_server" configure_server_logging() diff --git a/src/bentoml_cli/worker/http_api_server.py b/src/bentoml_cli/worker/http_api_server.py index 38e138b5d61..efc52570020 100644 --- a/src/bentoml_cli/worker/http_api_server.py +++ b/src/bentoml_cli/worker/http_api_server.py @@ -121,11 +121,11 @@ def main( import bentoml from bentoml._internal.configuration.containers import BentoMLContainer - from bentoml._internal.context import component_context + from bentoml._internal.context import server_context from bentoml._internal.log import configure_server_logging - component_context.component_type = "api_server" - component_context.component_index = worker_id + server_context.service_type = "api_server" + server_context.worker_index = worker_id configure_server_logging() if worker_id is None: @@ -146,13 +146,13 @@ def main( svc = bentoml.load(bento_identifier, working_dir=working_dir, standalone_load=True) # setup context - component_context.component_name = svc.name + server_context.service_name = svc.name if svc.tag is None: - component_context.bento_name = svc.name - component_context.bento_version = "not available" + server_context.bento_name = svc.name + server_context.bento_version = "not available" else: - component_context.bento_name = svc.tag.name - component_context.bento_version = svc.tag.version or "not available" + server_context.bento_name = svc.tag.name + server_context.bento_version = svc.tag.version or "not available" uvicorn_options: dict[str, t.Any] = { "backlog": backlog, diff --git a/src/bentoml_cli/worker/runner.py b/src/bentoml_cli/worker/runner.py index 9417feffd43..56147cfa156 100644 --- a/src/bentoml_cli/worker/runner.py +++ b/src/bentoml_cli/worker/runner.py @@ -89,12 +89,12 @@ def main( import psutil from bentoml import load - from bentoml._internal.context import component_context + from bentoml._internal.context import server_context # setup context - component_context.component_type = "runner" - component_context.component_name = runner_name - component_context.component_index = worker_id + server_context.service_type = "runner" + server_context.service_name = runner_name + server_context.worker_index = worker_id from bentoml._internal.log import configure_server_logging @@ -117,11 +117,11 @@ def main( # setup context if service.tag is None: - component_context.bento_name = service.name - component_context.bento_version = "not available" + server_context.bento_name = service.name + server_context.bento_version = "not available" else: - component_context.bento_name = service.tag.name - component_context.bento_version = service.tag.version or "not available" + server_context.bento_name = service.tag.name + server_context.bento_version = service.tag.version or "not available" for runner in service.runners: if runner.name == runner_name: diff --git a/tests/unit/_internal/utils/circus/test_watchfilesplugin.py b/tests/unit/_internal/utils/circus/test_watchfilesplugin.py index 0420e6150f2..049b2d86df1 100644 --- a/tests/unit/_internal/utils/circus/test_watchfilesplugin.py +++ b/tests/unit/_internal/utils/circus/test_watchfilesplugin.py @@ -65,7 +65,7 @@ def mock_bentoml_component_context(self) -> MagicMock: from bentoml._internal.context import _ComponentContext # prevent error from double setting component name - _ComponentContext.component_name = None + _ComponentContext.service_name = None def mock_bentoml_server_logging(self) -> MagicMock: patcher = patch(