コード例 #1
0
ファイル: __init__.py プロジェクト: subhayuroy/BentoML
def save(bento_service, base_path=None, version=None, labels=None):
    """
    Save and register the given BentoService via BentoML's built-in model management
    system. BentoML by default keeps track of all the SavedBundle's files and metadata
    in local file system under the $BENTOML_HOME(~/bentoml) directory. Users can also
    configure BentoML to save their BentoService to a shared Database and cloud object
    storage such as AWS S3.

    :param bento_service: target BentoService instance to be saved
    :param base_path: optional - override repository base path
    :param version: optional - save with version override
    :param labels: optional - user defined labels

    :return: saved_path: file path to where the BentoService is saved
    """

    logger.warning(
        "`from bentoml import save` is being deprecated soon, use BentoService#save "
        "and BentoService#save_to_dir instead.")

    from bentoml.yatai.client import YataiClient
    from bentoml.yatai.yatai_service import get_yatai_service

    if base_path:
        yatai_service = get_yatai_service(file_system_directory=base_path)
        yatai_client = YataiClient(yatai_service)
    else:
        yatai_client = YataiClient()

    return yatai_client.repository.upload(bento_service, version, labels)
コード例 #2
0
def test_track_server_successful_delete(mock_deployment_store):
    mock_deployment_store.return_value.get.return_value = mock_deployment_pb()
    with patch('bentoml.yatai.yatai_service_impl.track') as mock:
        mock.side_effect = mock_track_func
        with patch('bentoml.yatai.yatai_service_impl.get_deployment_operator'
                   ) as mock_get_deployment_operator:
            mock_get_deployment_operator.side_effect = mock_get_operator_func()
            yatai_service = get_yatai_service()
            delete_request = MagicMock()
            delete_request.deployment_name = MOCK_DEPLOYMENT_NAME
            delete_request.namespace = MOCK_DEPLOYMENT_NAMESPACE
            delete_request.force_delete = False
            yatai_service.DeleteDeployment(delete_request)
            event_name, properties = mock.call_args_list[0][0]
            assert event_name == 'deployment-AZURE_FUNCTIONS-stop'
コード例 #3
0
ファイル: __init__.py プロジェクト: subhayuroy/BentoML
def get_yatai_client(yatai_url: str = None) -> "YataiClient":
    """
    Args:
        yatai_url (`str`):
            Yatai Service URL address.

    Returns:
        :obj:`~YataiClient`, a python client to interact with :obj:`Yatai` gRPC server.

    Example::

        from bentoml.yatai.client import get_yatai_client

        custom_url = 'https://remote.yatai:50050'
        yatai_client = get_yatai_client(custom_url)
    """  # noqa: E501

    yatai_service = get_yatai_service(channel_address=yatai_url)
    return YataiClient(yatai_service=yatai_service)
コード例 #4
0
ファイル: __init__.py プロジェクト: zidingz/BentoML
def get_yatai_client(yatai_service_channel_address=None):
    """
    Args:
        yatai_service_channel_address: String. Yatai Service URL address.

    Returns:
        YataiClient instance

    Example:

    >>>  from bentoml.yatai.client import get_yatai_client
    >>>
    >>>  remote_yatai_service_address = 'https://remote.yatai:50050'
    >>>  yatai_client = get_yatai_client(remote_yatai_service_address)
    >>>
    >>>  local_yatai_client = get_yatai_client()
    """
    yatai_service = get_yatai_service(channel_address=yatai_service_channel_address)
    return YataiClient(yatai_service=yatai_service)
コード例 #5
0
ファイル: service.py プロジェクト: umihui/BentoML
def save(bento_service, base_path=None, version=None):
    """
    Save and register the given BentoService via BentoML's built-in model management
    system. BentoML by default keeps track of all the SavedBundle's files and metadata
    in local file system under the $BENTOML_HOME(~/bentoml) directory. Users can also
    configure BentoML to save their BentoService to a shared Database and cloud object
    storage such as AWS S3.

    :param bento_service: target BentoService instance to be saved
    :param base_path: optional - override repository base path
    :param version: optional - save with version override
    :return: saved_path: file path to where the BentoService is saved
    """

    from bentoml.yatai.client import YataiClient
    from bentoml.yatai.yatai_service import get_yatai_service

    if base_path:
        yatai_service = get_yatai_service(repo_base_url=base_path)
        yatai_client = YataiClient(yatai_service)
    else:
        yatai_client = YataiClient()

    return yatai_client.repository.upload(bento_service, version)
コード例 #6
0
ファイル: __init__.py プロジェクト: subhayuroy/BentoML
 def __init__(self, yatai_service: Optional["YataiStub"] = None):
     self.yatai_service = yatai_service if yatai_service else get_yatai_service(
     )
     self.bento_repository_api_client = None
     self.deployment_api_client = None
コード例 #7
0
def get_yatai_client(yatai_service_channel_address=None):
    yatai_service = get_yatai_service(
        channel_address=yatai_service_channel_address)
    return YataiClient(yatai_service=yatai_service)