Yatai Client¶
-
bentoml.yatai.client.
get_yatai_client
(yatai_url=None)¶ - Parameters
yatai_service_channel_address – String. Yatai Service URL address.
- Returns
YataiClient instance
Example:
>>> from bentoml.yatai.client import get_yatai_client >>> >>> yatai_url = 'https://remote.yatai:50050' >>> yatai_client = get_yatai_client(yatai_url) >>> >>> local_yatai_client = get_yatai_client()
-
class
bentoml.yatai.client.bento_repository_api.
BentoRepositoryAPIClient
(yatai_service)¶ -
push
(bento, labels=None)¶ Push a local BentoService to a remote yatai server.
- Parameters
bento – a BentoService identifier in the format of NAME:VERSION
labels – optional. List of labels for the BentoService.
- Returns
BentoService saved path
Example:
>>> svc = MyBentoService() >>> svc.save() >>> >>> remote_yatai_client = get_yatai_client('http://remote.yatai.service:50050') >>> bento = f'{svc.name}:{svc.version}' >>> remote_saved_path= remote_yatai_client.repository.push(bento)
-
pull
(bento)¶ Pull a BentoService from a remote yatai service. The BentoService will be saved and registered with local yatai service.
- Parameters
bento – a BentoService identifier in the form of NAME:VERSION
- Returns
BentoService saved path
Example:
>>> client = get_yatai_client('127.0.0.1:50051') >>> saved_path = client.repository.pull('MyService:')
-
list
(bento_name=None, offset=None, limit=None, labels=None, order_by=None, ascending_order=None)¶ List BentoServices that satisfy the specified criteria.
- Parameters
bento_name – optional. BentoService name
limit – optional. maximum number of returned results
labels – optional.
offset – optional. offset of results
order_by – optional. order by results
ascending_order – optional. direction of results order
- Returns
[bentoml.yatai.proto.repository_pb2.Bento]
Example:
>>> yatai_client = get_yatai_client() >>> bentos_info_list = yatai_client.repository.list( >>> labels='key=value,key2=value' >>> )
-
delete
(bento_tag=None, labels=None, bento_name=None, bento_version=None, prune=False, require_confirm=False)¶ Delete bentos that matches the specified criteria
- Parameters
bento_tag – string
labels – string
bento_name – string
bento_version – string
prune – boolean, Set True to delete all BentoService
require_confirm – boolean
Example: >>> >>> yatai_client = get_yatai_client() >>> # Delete all bento services >>> yatai_client.repository.delete(prune=True) >>> # Delete bento service with name is IrisClassifier and version 0.1.0 >>> yatai_client.repository.delete( >>> bento_name=’IrisClassifier’, bento_version=’0.1.0’ >>> ) >>> # or use bento tag >>> yatai_client.repository.delete(‘IrisClassifier:v0.1.0’) >>> # Delete all bento services with name ‘MyService` >>> yatai_client.repository.delete(bento_name=’MyService’) >>> # Delete all bento services with labels match ci=failed and cohort=20 >>> yatai_client.repository.delete(labels=’ci=failed, cohort=20’)
-
containerize
(bento, tag=None, build_args=None, push=False)¶ Create a container image from a BentoService.
- Parameters
bento – string
tag – string
build_args – dict
push – boolean
- Returns
String
- Return type
Image tag
-
load
(bento)¶ Load bento service from bento tag or from a bento bundle path. :param bento: string,
- Returns
BentoService instance
Example: >>> yatai_client = get_yatai_client() >>> # Load BentoService bases on bento tag. >>> bento = yatai_client.repository.load(‘Service_name:version’) >>> # Load BentoService from bento bundle path >>> bento = yatai_client.repository.load(‘/path/to/bento/bundle’) >>> # Load BentoService from s3 storage >>> bento = yatai_client.repository.load(‘s3://bucket/path/bundle.tar.gz’)
-