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)¶ Delete bento
- Parameters
bento – a BentoService identifier in the format of NAME:VERSION
Example: >>> >>> yatai_client = get_yatai_client() >>> yatai_client.repository.delete(‘my_service:version’)
-
prune
(bento_name=None, labels=None)¶ Delete all BentoServices that matches the specified criteria
- Parameters
bento_name – optional
labels – optional
Example:
>>> yatai_client = get_yatai_client() >>> # Delete all bento services >>> yatai_client.repository.prune() >>> # Delete bento services that matches with the label `ci=failed` >>> yatai_client.repository.prune(labels='ci=failed')
-
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
-