bentoml / BentoML

The easiest way to serve AI apps and models - Build Model Inference APIs, Job queues, LLM apps, Multi-model pipelines, and more!
https://bentoml.com
Apache License 2.0
7.17k stars 792 forks source link

Parameter 's3_endpoint_url' cannot get injected into get_yatai_service #1707

Closed notniknot closed 3 years ago

notniknot commented 3 years ago

Describe the bug When using a self hosted MinIO as S3 storage, the generated presigned url contains the amazonaws domain, such as 'https://yatai-bucket.s3.amazonaws.com/IrisClassifier/26.tar.gz?...'. Thus, storing and loading models from S3 storage result in an error. This bug is new in Version 0.13.0.

The function _get_yataiservice lacks the s3_endpoint_url parameter. Additionally, if no channel_address in _get_yataiservice is given, the call to _createrepository for the repository parameter of LocalYataiService lacks the s3_endpoint_url.

This can be fixed by first adding the following paramter to the _get_yataiservice function (yatai/yatai_services.py): s3_endpoint_url: str = Provide[BentoMLContainer.config.yatai.repository.s3.endpoint_url],

And second, adding the s3_endpoint as paramter to the _createrepository call inside of the _get_yataiservice function (yatai/yatai_services.py):

repository = create_repository(
        repository_type=repository_type,
        file_system_directory=file_system_directory,
        s3_url=s3_url,
        s3_endpoint_url=s3_endpoint_url,
        gcs_url=gcs_url,
)

To Reproduce

  1. Set up a local MinIO-Storage
  2. Reference the storage in the config yaml:
    yatai:
    repository:
        type: s3
        s3:
            signature_version: s3v4
            url: s3://yatai-bucket/
            endpoint_url: http://...
  3. Create a simple hello world example: https://docs.bentoml.org/en/latest/quickstart.html#example-hello-world
  4. See error when saving the service class

Expected behavior The model gets saved in the MinIO storage.

Environment:

bojiang commented 3 years ago

Hi @notniknot. Thanks for reporting! Could you plz give it a try on my branch "https://github.com/bentoml/BentoML/pull/1705"?

bojiang commented 3 years ago

pip install git+https://github.com/bojiang/BentoML.git@di2

notniknot commented 3 years ago

Hi @bojiang. Sorry, but I still get a presigned amazonaws url. The _get_yataiservice function is missing the proposed changes.

bojiang commented 3 years ago

@notniknot Oh, I see. Thanks.