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

feat: YataiClient context to communicate with multiple Yatai instances #3448

Merged
merged 2 commits into from
Jan 19, 2023

Conversation

ssheng
Copy link
Collaborator

@ssheng ssheng commented Jan 18, 2023

What does this PR address?

The .yatai.yaml configuration under BENTOML_HOME already supports contexts to communicate with multiple Yatai instances through different API tokens today. However, the same functionality was not exposed to the CLI commands and YataiClient API. This PR exposes setting and selecting contexts in the CLI.

Yatai Log-in

> bentoml yatai login --api-token xxx --endpoint https://yatai1 --context yatai1
Successfully logged in as user "ssheng" in organization "yatai1".
> bentoml yatai login --api-token xxx --endpoint https://yatai2 --context yatai2
Successfully logged in as user "ssheng" in organization "yatai2".

Bento push & pull

> bentoml push iris_classifier:x67srpdqs25aicvj --context yatai1
> bentoml push iris_classifier:x67srpdqs25aicvj --context yatai2

Model push & pull

> bentoml models push iris_clf:7r5r5ftamc3dccvj --context=yatai1
> bentoml models push iris_clf:7r5r5ftamc3dccvj --context=yatai2

YataiClient API

yatai_client.push_bento(bento, context="yatai1")
yatai_client.pull_bento(bento_tag, context="yatai1")
yatai_client.push_model(model, context="yatai1")
yatai_client.pull_model(model_tag, context="yatai1")

Before submitting:

@ssheng ssheng requested a review from a team as a code owner January 18, 2023 10:53
@ssheng ssheng requested review from sauyon and removed request for a team January 18, 2023 10:53
@codecov
Copy link

codecov bot commented Jan 18, 2023

Codecov Report

Merging #3448 (75070f0) into main (1d91d8c) will decrease coverage by 0.36%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3448      +/-   ##
==========================================
- Coverage   33.10%   32.75%   -0.36%     
==========================================
  Files         132      134       +2     
  Lines       10689    10836     +147     
  Branches     1778     1712      -66     
==========================================
+ Hits         3539     3549      +10     
- Misses       6910     7049     +139     
+ Partials      240      238       -2     
Impacted Files Coverage Δ
src/bentoml/_internal/io_descriptors/pandas.py 39.03% <0.00%> (-3.92%) ⬇️
src/bentoml/_internal/io_descriptors/numpy.py 42.57% <0.00%> (-3.80%) ⬇️
src/bentoml/_internal/container/__init__.py 76.00% <0.00%> (-2.00%) ⬇️
src/bentoml/_internal/container/base.py 61.68% <0.00%> (-1.87%) ⬇️
src/bentoml/_internal/configuration/__init__.py 60.52% <0.00%> (-1.32%) ⬇️
src/bentoml/_internal/utils/__init__.py 44.96% <0.00%> (-0.78%) ⬇️
src/bentoml/__init__.py 100.00% <0.00%> (ø)
src/bentoml/_internal/models/model.py 77.88% <0.00%> (ø)
src/bentoml/_internal/server/server.py 0.00% <0.00%> (ø)
src/bentoml/_internal/utils/benchmark.py 0.00% <0.00%> (ø)
... and 7 more

Copy link
Contributor

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Contributor

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

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

I'm thinking maybe for push and pull we can be more explicit

bentoml models push ... --yatai-context

whereas for bentoml yatai --context works?

@aarnphm aarnphm self-requested a review January 18, 2023 20:05
@ssheng
Copy link
Collaborator Author

ssheng commented Jan 18, 2023

I'm thinking maybe for push and pull we can be more explicit

bentoml models push ... --yatai-context

whereas for bentoml yatai --context works?

Make sense but in the case of BentoCloud, I worry that the yatai prefix maybe irrelevant or misleading.

@aarnphm
Copy link
Contributor

aarnphm commented Jan 18, 2023

Make sense but in the case of BentoCloud, I worry that the yatai prefix maybe irrelevant or misleading.

How about bentoml models push --remote-context?

Copy link
Contributor

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

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

As discussed.

src/bentoml_cli/yatai.py Show resolved Hide resolved
src/bentoml_cli/yatai.py Show resolved Hide resolved
src/bentoml_cli/yatai.py Show resolved Hide resolved
src/bentoml_cli/models.py Show resolved Hide resolved
src/bentoml_cli/models.py Show resolved Hide resolved
src/bentoml_cli/bentos.py Show resolved Hide resolved
src/bentoml_cli/bentos.py Show resolved Hide resolved
src/bentoml_cli/bentos.py Show resolved Hide resolved
src/bentoml_cli/bentos.py Show resolved Hide resolved
src/bentoml_cli/bentos.py Show resolved Hide resolved
@ssheng ssheng merged commit 4d2fd62 into bentoml:main Jan 19, 2023
@ssheng ssheng deleted the yatai-client-context branch January 19, 2023 04:58
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.

3 participants