This message was deleted.
# ask-for-help
s
This message was deleted.
🍱 1
j
Hi.
bentoml serve
definitely should not require yatai login.
Is this the full log trace?
could you run
bentoml serve
with
--debug
flag for more error details?
a
Copy code
host:<http://hc-prd-mlflow-bucket.s3.amazonaws.com|hc-prd-mlflow-bucket.s3.amazonaws.com>
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20221221T083515Z

host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
2022-12-21T14:05:15+0530 [DEBUG] [cli] StringToSign:
AWS4-HMAC-SHA256
20221221T083515Z
20221221/us-east-1/s3/aws4_request
90709d00874a430dc0236bc9f533b93aa0ed3abc1a5cc43443a2da8300dc6e4a
2022-12-21T14:05:15+0530 [DEBUG] [cli] Signature:
0c67eec693a47dd2eb6257cfb93dc48f5d35de5fb71c4e65b4ffdf48d8620c59
2022-12-21T14:05:15+0530 [DEBUG] [cli] Event request-created.s3.GetObject: calling handler <function signal_transferring at 0x1253590d0>
2022-12-21T14:05:15+0530 [DEBUG] [cli] Event request-created.s3.GetObject: calling handler <function add_retry_headers at 0x12499fca0>
2022-12-21T14:05:15+0530 [DEBUG] [cli] Sending http request: <AWSPreparedRequest stream_output=True, method=GET, url=<https://hc-prd-mlflow-bucket.s3.amazonaws.com/bentoml/model/example.bentomodel>, headers={'User-Agent': b'Boto3/1.26.33 Python/3.9.15 Darwin/22.1.0 Botocore/1.29.33', 'X-Amz-Date': b'20221221T083515Z', 'X-Amz-Content-SHA256': b'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIA5KENQZGPEG3BIWE3/20221221/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=0c67eec693a47dd2eb6257cfb93dc48f5d35de5fb71c4e65b4ffdf48d8620c59', 'amz-sdk-invocation-id': b'5d30d53f-6d95-42e9-953f-cc8354b6d3d2', 'amz-sdk-request': b'attempt=1'}>
2022-12-21T14:05:15+0530 [DEBUG] [cli] <https://hc-prd-mlflow-bucket.s3.amazonaws.com:443> "GET /bentoml/model/example.bentomodel HTTP/1.1" 200 694872
2022-12-21T14:05:15+0530 [DEBUG] [cli] Response headers: {'x-amz-id-2': 'mbwLytHN8rUEUO9cK9hs0Z8LPhE+o8s59pWAb3/8jQjQmTvW2i81a8X7/UAb7sDuPV3BUTsBXMo+GouRwYZsPw==', 'x-amz-request-id': '1R4NZBCPS1S75328', 'Date': 'Wed, 21 Dec 2022 08:35:16 GMT', 'Last-Modified': 'Wed, 21 Dec 2022 08:11:30 GMT', 'ETag': '"2be59b6a569838497412c1f868d18693"', 'Accept-Ranges': 'bytes', 'Content-Type': 'binary/octet-stream', 'Server': 'AmazonS3', 'Content-Length': '694872'}
2022-12-21T14:05:15+0530 [DEBUG] [cli] Response body:
<botocore.response.StreamingBody object at 0x1254d8a30>
2022-12-21T14:05:15+0530 [DEBUG] [cli] Event needs-retry.s3.GetObject: calling handler <botocore.retryhandler.RetryHandler object at 0x1254a4f10>
2022-12-21T14:05:15+0530 [DEBUG] [cli] No retry needed.
2022-12-21T14:05:15+0530 [DEBUG] [cli] Event needs-retry.s3.GetObject: calling handler <bound method S3RegionRedirectorv2.redirect_from_error of <botocore.utils.S3RegionRedirectorv2 object at 0x1254a4fd0>>
2022-12-21T14:05:19+0530 [DEBUG] [cli] IOWriteTask(transfer_id=0, {'offset': 0}) about to wait for the following futures []
2022-12-21T14:05:19+0530 [DEBUG] [cli] IOWriteTask(transfer_id=0, {'offset': 0}) done waiting for dependent futures
2022-12-21T14:05:19+0530 [DEBUG] [cli] Executing task IOWriteTask(transfer_id=0, {'offset': 0}) with kwargs {'fileobj': <_io.BufferedWriter name=b'/var/folders/q2/zp1ts4yj36n_wlqb711d2y5r0000gq/T/tmpi75gwt4nbentoml-example.bentomodel-import/example.bentomodel'>, 'offset': 0}
2022-12-21T14:05:20+0530 [DEBUG] [cli] IOWriteTask(transfer_id=0, {'offset': 262144}) about to wait for the following futures []
2022-12-21T14:05:20+0530 [DEBUG] [cli] IOWriteTask(transfer_id=0, {'offset': 262144}) done waiting for dependent futures
2022-12-21T14:05:20+0530 [DEBUG] [cli] Executing task IOWriteTask(transfer_id=0, {'offset': 262144}) with kwargs {'fileobj': <_io.BufferedWriter name=b'/var/folders/q2/zp1ts4yj36n_wlqb711d2y5r0000gq/T/tmpi75gwt4nbentoml-example.bentomodel-import/example.bentomodel'>, 'offset': 262144}
2022-12-21T14:05:20+0530 [DEBUG] [cli] IOWriteTask(transfer_id=0, {'offset': 524288}) about to wait for the following futures []
2022-12-21T14:05:20+0530 [DEBUG] [cli] IOWriteTask(transfer_id=0, {'offset': 524288}) done waiting for dependent futures
2022-12-21T14:05:20+0530 [DEBUG] [cli] Executing task IOWriteTask(transfer_id=0, {'offset': 524288}) with kwargs {'fileobj': <_io.BufferedWriter name=b'/var/folders/q2/zp1ts4yj36n_wlqb711d2y5r0000gq/T/tmpi75gwt4nbentoml-example.bentomodel-import/example.bentomodel'>, 'offset': 524288}
2022-12-21T14:05:20+0530 [DEBUG] [cli] CompleteDownloadNOOPTask(transfer_id=0, {}) about to wait for the following futures []
2022-12-21T14:05:20+0530 [DEBUG] [cli] CompleteDownloadNOOPTask(transfer_id=0, {}) done waiting for dependent futures
2022-12-21T14:05:20+0530 [DEBUG] [cli] Executing task CompleteDownloadNOOPTask(transfer_id=0, {}) with kwargs {}
2022-12-21T14:05:20+0530 [DEBUG] [cli] Releasing acquire 0/None
2022-12-21T14:05:21+0530 [DEBUG] [cli] Tracking Error: Not found default yatai context, please login!
Error: [bentoml-cli] `serve` failed: Item 'example:bg5scseba6lmjlg6' already exists in the store <osfs '/Users/abhishekchoudhary/bentoml/bentos/example/e4dbxeua7ogwblg6/models'>
Traceback (most recent call last):
  File "/Users/abhishekchoudhary/.pyenv/versions/test_env/bin/bentoml", line 8, in <module>
    sys.exit(cli())
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml_cli/utils.py", line 273, in wrapper
    raise err from None
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml_cli/utils.py", line 268, in wrapper
    return func(*args, **kwargs)
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml_cli/utils.py", line 239, in wrapper
    return_value = func(*args, **kwargs)
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml_cli/utils.py", line 196, in wrapper
    return func(*args, **kwargs)
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml_cli/serve.py", line 211, in serve
    serve_http_development(
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/simple_di/__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml/serve.py", line 191, in serve_http_development
    svc = load(bento_identifier, working_dir=working_dir)
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml/_internal/service/loader.py", line 368, in load
    svc = load_bento(bento_identifier, standalone_load=standalone_load)
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/simple_di/__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml/_internal/service/loader.py", line 221, in load_bento
    return _load_bento(bento, standalone_load)
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml/_internal/service/loader.py", line 247, in _load_bento
    svc = import_service(
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/simple_di/__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml/_internal/service/loader.py", line 137, in import_service
    module = importlib.import_module(module_name, package=working_dir)
  File "/usr/local/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/abhishekchoudhary/bentoml/bentos/example/e4dbxeua7ogwblg6/src/bento_service.py", line 18, in <module>
    bento_model = bentoml.models.import_model(
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/simple_di/__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml/models.py", line 117, in import_model
    return Model.import_from(
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml/_internal/models/model.py", line 216, in _save
    with model_store.register(self.tag) as model_path:
  File "/usr/local/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/Users/abhishekchoudhary/.pyenv/versions/3.9.1/envs/test_env/lib/python3.9/site-packages/bentoml/_internal/store.py", line 166, in register
    raise BentoMLException(
bentoml.exceptions.BentoMLException: Item 'example:bg5scseba6lmjlg6' already exists in the store <osfs '/Users/abhishekchoudhary/bentoml/bentos/example/e4dbxeua7ogwblg6/models'>
j
Hi. It is because of a misusing of the import_model
a
I am importing model directly from S3, should I change it ?
j
import model
API basically means importing a model into the user model store.
And it always happens during bento development stage. Once we finished the development and run
bentoml build
,
bentoml
will pack the models into the generated bento.
The bentos become the deliverables between development stage and the deployment stage. Thus we won't need to import the model again during development stage.
We should use
bentoml.models.get
here to get the model from the models store
a
Okay I understand, let's imagine a situation. I want to dockerize bento and push to AWS ECR using GitHub action. Since it's an MLFlow model, i can't call bentoml build from GitHub action as it will try to interact with mlflow tracking server which can't be done So I will save the bentos right after mlflow model build and export it to s3
Next i just go GitHub action , import the bento from S3 and then call bentoml dockerize -- docker tag --- docker push
Is there any other way to achieve the same so that I could push a bentoml mlflow model to ECR via GitHub action
j
I'm not sure if I understand your case well, but I think we can add an extra pipeline step here
I this step, we have a bentoml service project here, and just call
Copy code
bentoml models import <s3>
then
Copy code
bentoml build
to build a valid bento
Copy code
$ cd /patj/to/our_bentoml_project
$ bentoml models import <s3>
$ bentoml build
$ bentoml export <the bento> ./
$ cp ./<the bento> /to/the/dest
something like this
a
Thanks for your help @Jiang, i will try
j
np. And we have to use
bentoml.models.get
instead of
bentoml.models.import_model
in the
bento_service.py
, of course. They are way diffrent.
a
Could you elaborate a bit on how exactly they are different? At my company, we use MLFlow as a model store, and we would prefer not to maintain a second (bentoml) remote model store. The solution I found so far was to use
bentoml.models.import_model
to import a model from MLFlow directly, so it can be used in the bentoml service definition.
@Jiang?
j
@Alexander Keijser Hi Alex. Could you ask in #support in a new thread if the question is still there?
a
I figured it out, thanks 👍