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

BentoML get improvement #825

Merged
merged 7 commits into from Jun 24, 2020
Merged

BentoML get improvement #825

merged 7 commits into from Jun 24, 2020

Conversation

jackyzha0
Copy link
Collaborator

@jackyzha0 jackyzha0 commented Jun 21, 2020

Description

Adds --print-location flag to bentoml get <bento>:<version>

Motivation and Context

How Has This Been Tested?

Locally.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Documentation
  • Test, CI, or build
  • None

Components (if applicable)

  • BentoService (model packaging, dependency management, handler definition)
  • Model Artifact (model serialization, multi-framework support)
  • Model Server (mico-batching, logging, metrics, tracing, benchmark, OpenAPI)
  • YataiService (model management, deployment automation)
  • Documentation

Checklist:

  • My code follows the bentoml code style, both ./dev/format.sh and
    ./dev/lint.sh script have passed
    (instructions).
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • My change requires a change in bentoml/gallery example notebooks
  • I have sent a pull request to bentoml/gallery to make that change

@pep8speaks
Copy link

pep8speaks commented Jun 21, 2020

Hello @jackyzha0, Thanks for updating this PR.

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

Comment last updated at 2020-06-24 06:00:39 UTC

_print_bento_info(bento, output_type)


def _unpack_jq_like_string(bento_dict, jq):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit renaming jq to json_query or something more descriptive.

bento_dict = bento_dict[_t]
except KeyError:
_echo(
f'Key {_t} not found, ignoring', CLI_COLOR_ERROR,
Copy link
Contributor

Choose a reason for hiding this comment

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

We can make this error message more descriptive to better inform the users. Failed to query {json_query}. Key {_t} is missing.

@jackyzha0 jackyzha0 marked this pull request as ready for review June 21, 2020 19:10
@codecov
Copy link

codecov bot commented Jun 21, 2020

Codecov Report

Merging #825 into master will decrease coverage by 1.52%.
The diff coverage is 40.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #825      +/-   ##
==========================================
- Coverage   56.41%   54.89%   -1.53%     
==========================================
  Files         116      120       +4     
  Lines        8608     8996     +388     
==========================================
+ Hits         4856     4938      +82     
- Misses       3752     4058     +306     
Impacted Files Coverage Δ
bentoml/cli/bento.py 29.36% <40.00%> (-0.15%) ⬇️
bentoml/yatai/proto/yatai_service_pb2_grpc.py 29.16% <0.00%> (-13.04%) ⬇️
bentoml/yatai/validator/deployment_pb_validator.py 84.00% <0.00%> (-11.00%) ⬇️
bentoml/adapters/tensorflow_tensor_input.py 60.75% <0.00%> (-9.25%) ⬇️
bentoml/adapters/utils.py 83.67% <0.00%> (-7.38%) ⬇️
bentoml/yatai/deployment_utils.py 77.08% <0.00%> (-6.64%) ⬇️
bentoml/yatai/deployment/operator.py 55.17% <0.00%> (-6.37%) ⬇️
bentoml/adapters/default_output.py 78.57% <0.00%> (-4.77%) ⬇️
bentoml/adapters/base_input.py 84.21% <0.00%> (-1.91%) ⬇️
bentoml/configuration/__init__.py 76.62% <0.00%> (-1.76%) ⬇️
... and 26 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 8741efd...19ee500. Read the comment docs.

_print_bento_info(bento, output_type)


def _unpack_jq_like_string(bento_dict, json_query):
Copy link
Member

Choose a reason for hiding this comment

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

jq actually supports many other syntax(https://stedolan.github.io/jq/tutorial/), I'd prefer not to expose this to the user if it does not fully support all the possible jq queries(e.g. the syntax for accessing array item).

Getting the location is a very common task and we don't want to force every user to install jq just for that. But for advanced users who can write jq query, I think installing jq wouldn't be a problem and we should probably just let them use command line jq with our json output.

if output_type == 'table':
_print_bento_table(bentos)
elif output_type == 'wide':
_print_bento_table(bentos, wide=True)
else:
for bento in bentos:
if print_location:
Copy link
Member

Choose a reason for hiding this comment

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

Only printing a list of path seems not that useful to the user, currently the user can already use bentoml list -o wide or bentoml get IrisClassifier -o wide to view the list of saved bundle alongside with the saved location. I think it's ok to just ignore the --print-location argument in the case of listing and only apply it to get

@parano parano self-requested a review June 24, 2020 06:33
@parano parano merged commit 05aea90 into bentoml:master Jun 24, 2020
aarnphm pushed a commit to aarnphm/BentoML that referenced this pull request Jul 29, 2022
* add print_location flag

* add python like jq interp option

* fix test import and linting issues

* fix typo lmao

* linter

* fix more linting issues and address review comments

* remove jq-like parsing stuff
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.

Add --print-location option to bentoml get command
4 participants