Implementation:Bentoml BentoML YataiClient
| Knowledge Sources | |
|---|---|
| Domains | Cloud, Model Management, Bento Management, Remote Storage |
| Last Updated | 2026-02-13 15:00 GMT |
Overview
The YataiClient class provides push and pull operations for synchronizing both BentoML Bentos and Models between local stores and a remote Yatai server.
Description
YataiClient is the legacy client for interacting with the Yatai model and bento management server. It implements four main operations:
- push_bento(): Pushes a Bento (including its dependent models) to the Yatai server. Models are pushed concurrently using a thread pool before the Bento archive itself is uploaded.
- pull_bento(): Pulls a Bento from the Yatai server, downloading dependent models concurrently and extracting the Bento tar archive into the local store.
- push_model(): Pushes a single model to the Yatai server using proxy, presigned URL, or multipart upload strategies.
- pull_model(): Pulls a single model from the Yatai server with support for version resolution (including "latest"), presigned URL downloads, and local caching.
All upload methods support three transmission strategies: proxy (upload through the Yatai API server), presigned_url (direct upload to object storage), and multipart (chunked upload for large files). Progress is tracked through a Spinner with rich progress bars. Thread-safe I/O progress tracking is ensured via mutex locks.
Usage
Used internally by BentoML when users interact with the Yatai server (the legacy centralized model/bento management platform). This is the backend for bentoml push and bentoml pull CLI commands when a Yatai server context is configured.
Code Reference
Source Location
- Repository: Bentoml_BentoML
- File: src/bentoml/_internal/cloud/yatai.py
- Lines: 1-977
Signature
class YataiClient:
def __init__(self) -> None: ...
def push_bento(self, bento: Bento, *, force: bool = False,
threads: int = 10, context: str | None = None) -> None: ...
def pull_bento(self, tag: str | Tag, *, force: bool = False,
context: str | None = None,
bento_store: BentoStore = ...) -> Bento: ...
def push_model(self, model: Model, *, force: bool = False,
threads: int = 10, context: str | None = None) -> None: ...
def pull_model(self, tag: str | Tag, *, force: bool = False,
context: str | None = None,
model_store: ModelStore = ...,
query: str | None = None) -> Model: ...
Import
from bentoml._internal.cloud.yatai import YataiClient
I/O Contract
Inputs
push_bento()
| Name | Type | Required | Description |
|---|---|---|---|
| bento | Bento | Yes | The Bento to push to Yatai, including its dependent models |
| force | bool | No | Force push even if the Bento already exists on Yatai (default: False) |
| threads | int | No | Number of threads for multipart upload (default: 10) |
| context | str or None | No | The Yatai context/endpoint configuration name |
pull_bento()
| Name | Type | Required | Description |
|---|---|---|---|
| tag | str or Tag | Yes | The tag of the Bento to pull |
| force | bool | No | Force pull even if the Bento exists locally (default: False) |
| context | str or None | No | The Yatai context/endpoint configuration name |
| bento_store | BentoStore | No | The local bento store (injected via DI) |
push_model()
| Name | Type | Required | Description |
|---|---|---|---|
| model | Model | Yes | The Model to push to Yatai |
| force | bool | No | Force push even if the model already exists (default: False) |
| threads | int | No | Number of threads for multipart upload (default: 10) |
| context | str or None | No | The Yatai context/endpoint configuration name |
pull_model()
| Name | Type | Required | Description |
|---|---|---|---|
| tag | str or Tag | Yes | The tag of the model to pull |
| force | bool | No | Force pull even if the model exists locally (default: False) |
| context | str or None | No | The Yatai context/endpoint configuration name |
| model_store | ModelStore | No | The local model store (injected via DI) |
| query | str or None | No | Query string for filtering the latest model version |
Outputs
| Method | Return Type | Description |
|---|---|---|
| push_bento() | None | Uploads the Bento and its models; raises BentoMLException on failure |
| pull_bento() | Bento | The pulled Bento instance saved to the local store |
| push_model() | None | Uploads the model; raises BentoMLException on failure |
| pull_model() | Model | The pulled Model instance saved to the local store |
Usage Examples
from bentoml._internal.cloud.yatai import YataiClient
import bentoml
# Create client instance
yatai_client = YataiClient()
# Push a bento to Yatai
bento = bentoml.bentos.get("my_service:latest")
yatai_client.push_bento(bento, force=False, context="default")
# Pull a bento from Yatai
pulled_bento = yatai_client.pull_bento("my_service:v1", context="default")
# Push a model to Yatai
model = bentoml.models.get("my_model:latest")
yatai_client.push_model(model, force=False, context="default")
# Pull a model from Yatai
pulled_model = yatai_client.pull_model("my_model:latest", context="default")