Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: on_deployment failed to run for serve_grpc #4963

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ git_describe_command = [
"--long",
"--first-parent",
]
version_scheme = "post-release"
fallback_version = "0.0.0"
[tool.hatch.metadata]
allow-direct-references = true
Expand Down
2 changes: 1 addition & 1 deletion src/bentoml/_internal/bento/build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def write_to_bento(
args.extend(pip_args)
f.write(
self._jinja_environment.get_template("install.sh.j2").render(
bentoml_version=clean_bentoml_version(BENTOML_VERSION),
bentoml_version=clean_bentoml_version(),
pip_args=shlex.join(args),
)
)
Expand Down
6 changes: 3 additions & 3 deletions src/bentoml/_internal/configuration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def expand_env_var(env_var: str) -> str:
env_var = interpolated


def clean_bentoml_version(bentoml_version: str) -> str:
post_version = ".".join(bentoml_version.split(".")[:3])
@lru_cache(maxsize=1)
def clean_bentoml_version() -> str:
try:
version = Version(post_version)
version = Version(BENTOML_VERSION).base_version
return str(version)
except ValueError:
raise BentoMLException("Errors while parsing BentoML version.") from None
Expand Down
4 changes: 1 addition & 3 deletions src/bentoml/serving.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import asyncio
import contextlib
import json
import logging
Expand Down Expand Up @@ -683,8 +682,7 @@ def serve_grpc_production(

close_child_stdin: bool = False if development_mode else True

loop = asyncio.get_event_loop()
loop.run_until_complete(on_service_deployment(svc))
on_service_deployment(svc)

with contextlib.ExitStack() as port_stack:
api_port = port_stack.enter_context(
Expand Down
3 changes: 1 addition & 2 deletions src/bentoml/testing/pytest/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from pytest import MonkeyPatch

import bentoml
from bentoml._internal.configuration import BENTOML_VERSION
from bentoml._internal.configuration import clean_bentoml_version
from bentoml._internal.configuration.containers import BentoMLContainer
from bentoml._internal.models import ModelContext
Expand Down Expand Up @@ -46,7 +45,7 @@

@pytest.mark.tryfirst
def pytest_report_header(config: Config) -> list[str]:
return [f"bentoml: version={clean_bentoml_version(BENTOML_VERSION)}"]
return [f"bentoml: version={clean_bentoml_version()}"]


@pytest.hookimpl
Expand Down
Loading