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

Add artifact loaded, packed, is_ready state check #921

Merged
merged 3 commits into from
Jul 21, 2020

Conversation

parano
Copy link
Member

@parano parano commented Jul 21, 2020

Description

Before #911, we used a slightly restricted pattern to ensure an artifact can only be accessed or saved after it has been packed or loaded from disk. #911 refactored the interface to make it cleaner to implement although it now missed the enforcement of packed or loaded state check before accessing the model. This PR adds that back by wrapping those methods and setting the internal state when pack or load is invoked.

Motivation and Context

This is part of an effort to provide a more flexible artifacts API that will allow custom model training workflows to integrate better with BentoML's model serving workflow #758

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 Jul 21, 2020

Hello @parano, Thanks for updating this PR.

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

Comment last updated at 2020-07-21 09:47:35 UTC

@parano parano changed the title Add artifact load/pack/is_ready state check Add artifact loaded, packed, is_ready state check Jul 21, 2020
@codecov
Copy link

codecov bot commented Jul 21, 2020

Codecov Report

Merging #921 into master will decrease coverage by 0.07%.
The diff coverage is 44.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #921      +/-   ##
==========================================
- Coverage   62.46%   62.38%   -0.08%     
==========================================
  Files         120      121       +1     
  Lines        7878     8000     +122     
==========================================
+ Hits         4921     4991      +70     
- Misses       2957     3009      +52     
Impacted Files Coverage Δ
bentoml/marshal/marshal.py 27.97% <0.00%> (-0.60%) ⬇️
bentoml/server/api_server.py 74.83% <ø> (ø)
bentoml/utils/flask_ngrok.py 0.00% <0.00%> (ø)
bentoml/server/__init__.py 44.82% <14.28%> (-5.18%) ⬇️
bentoml/artifact/artifact.py 95.23% <98.11%> (+4.32%) ⬆️
bentoml/cli/bento_service.py 70.86% <100.00%> (+0.19%) ⬆️
bentoml/marshal/dispatcher.py 90.27% <100.00%> (+6.60%) ⬆️
bentoml/artifact/sklearn_model_artifact.py 82.05% <0.00%> (+12.82%) ⬆️
... and 1 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 811e937...60048ba. Read the comment docs.

@parano parano merged commit b7e6fe1 into bentoml:master Jul 21, 2020
aarnphm pushed a commit to aarnphm/BentoML that referenced this pull request Jul 29, 2022
* add artifact state check

* Update artifact.py

* Update artifact.py
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.

2 participants