Skip to content

Commit 5acbb66

Browse files
authored
fix: loading service issue in worker (#5276)
* fix: loading service issue in worker Signed-off-by: Frost Ming <me@frostming.com>
1 parent 5e50d61 commit 5acbb66

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

src/_bentoml_impl/server/serving.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,11 @@ def serve_http(
196196
assert working_dir is None, (
197197
"working_dir should not be set when passing a service in process"
198198
)
199+
bento_identifier = svc.import_string
200+
bento_path = pathlib.Path(svc.working_dir)
199201
else:
200202
svc = load(bento_identifier, working_dir)
201-
bento_identifier = svc.import_string
202-
bento_path = pathlib.Path(svc.working_dir)
203+
bento_path = pathlib.Path(working_dir or ".")
203204

204205
# Process environment variables from the service
205206
for env_var in svc.envs:

src/_bentoml_impl/worker/service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def main(
160160
)
161161
os.environ.update(env_list[worker_key])
162162

163-
from _bentoml_impl.loader import import_service
163+
from _bentoml_impl.loader import load
164164
from bentoml._internal.container import BentoMLContainer
165165
from bentoml._internal.context import server_context
166166
from bentoml._internal.log import configure_server_logging
@@ -175,7 +175,7 @@ def main(
175175
server_context.worker_index = worker_id
176176
if model_preheat:
177177
patch_safetensor()
178-
service = import_service(bento_identifier)
178+
service = load(bento_identifier)
179179

180180
if service_name and service_name != service.name:
181181
service = service.find_dependent_by_name(service_name)

src/_bentoml_sdk/images.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,6 @@ def get_image_from_build_config(
275275
"python.wheels is not supported by bento v2, fallback to bento v1"
276276
)
277277
return None
278-
if python_options.pack_git_packages:
279-
logger.warning(
280-
"python.pack_git_packages is not supported by bento v2, fallback to bento v1"
281-
)
282-
return None
283278
image.lock_python_packages = python_options.lock_packages
284279
if python_options.index_url:
285280
image.python_packages(f"--index-url {python_options.index_url}")

src/bentoml/_internal/service/loader.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
import sys
77
import typing as t
8-
from pathlib import Path
98
from typing import TYPE_CHECKING
109

1110
import fs
@@ -84,12 +83,7 @@ def import_service(
8483

8584
if model_store is not global_model_store:
8685
BentoMLContainer.model_store.set(model_store)
87-
elif (
88-
Path(working_dir).with_name(BENTO_YAML_FILENAME).exists()
89-
and (bento_models := Path(working_dir).with_name("models")).exists()
90-
):
91-
if Path(model_store._fs.getsyspath("/")).absolute() != bento_models.absolute():
92-
BentoMLContainer.model_store.set(ModelStore(bento_models))
86+
9387
try:
9488
return _do_import(svc_import_path, working_dir, reload)
9589
except ImportServiceError:

0 commit comments

Comments
 (0)