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

[Feature]Bento managements with Yatai service #1126

Merged
merged 27 commits into from
Nov 12, 2020
Merged

Conversation

yubozhao
Copy link
Contributor

@yubozhao yubozhao commented Sep 23, 2020

Description

Add bento management for Yatai service

Python APIs:

Check out the yatai repository API reference at https://docs.bentoml.org/en/latest/api/yatai_client.html

push

bento_service.save() # Save and register the bento service to locally

# Push a locally saved BentoService to an remote yatai service and registry
yc = get_yatai_client('remote_yatai_address')
yc.repository.push(
    f'{bento_service.name}:{bento_service.version}',
) 
# params:
# bento_tag: string
# labels: dict

pull

# Pull bento service from remote yatai server and register locally
yc = get_yatai_client('remote_yatai_address')
yc.repository.pull(
    'bento_name:version',
)
# params:
# bento_tag: string

delete

#delete in local yatai
yatai_client = get_yatai_client()
yatai_client.repository.delete('name:version')

# params:
# bento_tag: string

prune

yatai_client = get_yatai_client()
yatai_client.prune(labels='cicd=failed, framework In (sklearn, xgboost)')

# params:
# labels: string optional, this is label selector query
# bento_name: string optional.

get

# Get bento service metadata
yatai_client.repository.get('bento_name:version', yatai_url='http://stagin.yatai.com:50050')
# params:
# bento_tag string

list_bentos

# List bento services that satisfy the criteria

yatai_client.repositorylist(labels='label_key In (value1, value2), label_key2 Exists', yatai_url='http://stagin.yatai.com:50050')
# params:
# labels: optional
# offset: optional
# bento_name: optional
# limit: optional
# order_by: optional
# ascending_order: optional

CLI changes:

bentoml push

$ bentoml push bento_service_name:version --yatai-url http://staging.yatai.com:50051

Add --yatai-url option for the following commands

  • bentoml get
  • bentoml list
  • bentoml delete
  • bentoml retrieve
  • bentoml run
  • bentoml serve
  • bentoml serve-gunicorn
  • bentoml info
  • bentoml open-api-spec

Motivation and Context

How Has This Been Tested?

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature and improvements (non-breaking change which adds/improves functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Code Refactoring (internal change which is not user facing)
  • Documentation
  • Test, CI, or build

Component(s) if applicable

  • BentoService (service definition, dependency management, API input/output adapters)
  • Model Artifact (model serialization, multi-framework support)
  • Model Server (mico-batching, dockerisation, logging, OpenAPI, instruments)
  • YataiService gRPC server (model registry, cloud deployment automation)
  • YataiService web server (nodejs HTTP server and web UI)
  • Internal (BentoML's own configuration, logging, utility, exception handling)
  • BentoML CLI

Checklist:

  • My code follows the bentoml code style, both ./dev/format.sh and
    ./dev/lint.sh script have passed
    (instructions).
  • My change reduces project test coverage and requires unit tests to be added
  • I have added unit tests covering my code change
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@pep8speaks
Copy link

pep8speaks commented Sep 23, 2020

Hello @yubozhao, Thanks for updating this PR.

There are currently no PEP 8 issues detected in this PR. Cheers! 🍻

Comment last updated at 2020-11-12 06:38:17 UTC

@codecov
Copy link

codecov bot commented Sep 23, 2020

Codecov Report

Merging #1126 (7c9214c) into master (74daa28) will increase coverage by 0.37%.
The diff coverage is 70.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1126      +/-   ##
==========================================
+ Coverage   65.55%   65.93%   +0.37%     
==========================================
  Files         141      141              
  Lines        9059     9116      +57     
==========================================
+ Hits         5939     6011      +72     
+ Misses       3120     3105      -15     
Impacted Files Coverage Δ
bentoml/saved_bundle/__init__.py 100.00% <ø> (ø)
bentoml/saved_bundle/templates.py 100.00% <ø> (ø)
bentoml/yatai/deployment/sagemaker/wsgi.py 0.00% <0.00%> (ø)
bentoml/server/gunicorn_server.py 40.54% <50.00%> (ø)
bentoml/cli/bento_management.py 66.66% <58.33%> (+10.46%) ⬆️
bentoml/yatai/client/bento_repository_api.py 68.57% <66.66%> (-6.43%) ⬇️
bentoml/saved_bundle/loader.py 54.96% <75.00%> (+2.29%) ⬆️
bentoml/utils/__init__.py 85.00% <77.77%> (+1.86%) ⬆️
bentoml/cli/bento_service.py 67.15% <95.23%> (+2.58%) ⬆️
bentoml/__init__.py 100.00% <100.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 74daa28...7c9214c. Read the comment docs.

@yubozhao yubozhao changed the title [Feature] Add push and pull features to interact with yatai service. [Feature]Bento managements with Yatai server Oct 7, 2020
@yubozhao yubozhao changed the title [Feature]Bento managements with Yatai server [Feature]Bento managements with Yatai service Oct 7, 2020
@yubozhao yubozhao force-pushed the pull-push branch 2 times, most recently from 2502051 to 82b1435 Compare October 21, 2020 22:53
@yubozhao yubozhao marked this pull request as ready for review October 23, 2020 19:53
@@ -232,7 +231,7 @@ def safe_retrieve(bundle_path, target_dir):
return


def load(bundle_path):
def load_from_bundle_path(bundle_path):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about make the bundler API consistent like this?

save_to_dir
load_from_dir

@@ -62,10 +62,6 @@ ver
+++
.. autofunction:: bentoml.ver

save
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep this? I don't think it's necessary to introduce this breaking change here.

"load",
"save",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's just keep save here?

@yubozhao yubozhao requested a review from parano November 12, 2020 06:45
@parano parano merged commit 06a40db into bentoml:master Nov 12, 2020
aarnphm pushed a commit to aarnphm/BentoML that referenced this pull request Jul 29, 2022
* Add yatai push and pull

* fix typo

* add bento service management

* rename loader.load to loader.load_from_bundle

* move save method to bento service management

* update

* format/lint

* update

* skipping mac ox ci, due to lack of docker

* update

* Update __init__.py

* format

* Renaming load_from_dir and keep track in the old location

* move service management to yatai client repository

* rebase to latest master

* uncomment pytest skip on mac

* formatting

* update doc

* Add yatai client to doc API reference

* use the correct method name

* formatting

* Update test_pip_install_saved_bundle.py

* Update test_pip_install_saved_bundle.py

* update cli message and pin urllib3

* formatting

* add back 'save'

* formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants