Exemplo n.º 1
0
    def deploy(archive_path, platform, region, stage, api_name, instance_type,
               instance_count):
        track_cli("deploy", platform)
        if platform in SERVERLESS_PLATFORMS:
            deployment = ServerlessDeployment(archive_path, platform, region,
                                              stage)
        elif platform == "aws-sagemaker":
            deployment = SagemakerDeployment(archive_path, api_name, region,
                                             instance_count, instance_type)
        else:
            _echo(
                "Deploying with --platform=%s is not supported in current version of "
                "BentoML" % platform,
                CLI_COLOR_ERROR,
            )
            return

        try:
            output_path = deployment.deploy()

            _echo(
                "Successfully deployed to {platform}!".format(
                    platform=platform),
                CLI_COLOR_SUCCESS,
            )
            _echo("Deployment archive is saved at: %s" % output_path)
        except Exception as e:  # pylint:disable=broad-except
            _echo(
                "Encounter error when deploying to {platform}\nError: {error_message}"
                .format(platform=platform, error_message=str(e)),
                CLI_COLOR_ERROR,
            )
Exemplo n.º 2
0
    def delete_deployment(archive_path, platform, region, stage, api_name):
        track_cli("delete-deploy", platform)
        if platform in SERVERLESS_PLATFORMS:
            deployment = ServerlessDeployment(archive_path, platform, region,
                                              stage)
        elif platform == "aws-sagemaker":
            deployment = SagemakerDeployment(archive_path, api_name, region)
        else:
            _echo(
                "Remove deployment with --platform=%s is not supported in current "
                "version of BentoML" % platform,
                CLI_COLOR_ERROR,
            )
            return

        if deployment.delete():
            _echo(
                "Successfully delete {platform} deployment".format(
                    platform=platform),
                CLI_COLOR_SUCCESS,
            )
        else:
            _echo(
                "Delete {platform} deployment unsuccessful".format(
                    platform=platform),
                CLI_COLOR_ERROR,
            )
Exemplo n.º 3
0
    def check_deployment_status(archive_path, platform, region, stage, api_name):
        if platform in SERVERLESS_PLATFORMS:
            deployment = ServerlessDeployment(archive_path, platform, region, stage)
        elif platform == 'aws-sagemaker':
            deployment = SagemakerDeployment(archive_path, api_name, region)
        else:
            raise BentoMLException('check deployment status with --platform=%s' % platform +
                                   'is not supported in the current version of BentoML')

        deployment.check_status()
        return
Exemplo n.º 4
0
    def deploy(archive_path, platform, region, stage, api_name, instance_type, instance_count):
        if platform in SERVERLESS_PLATFORMS:
            deployment = ServerlessDeployment(archive_path, platform, region, stage)
        elif platform == 'aws-sagemaker':
            deployment = SagemakerDeployment(archive_path, api_name, region, instance_count,
                                             instance_type)
        else:
            raise BentoMLException('Deploying with "--platform=%s" is not supported ' % platform +
                                   'in the current version of BentoML')
        output_path = deployment.deploy()

        _echo('Deploy to {platform} complete!'.format(platform=platform))
        _echo(
            'Deployment archive is saved at {output_path}'.format(output_path=output_path))
        return
Exemplo n.º 5
0
    def check_deployment_status(archive_path, platform, region, stage,
                                api_name):
        if platform in SERVERLESS_PLATFORMS:
            deployment = ServerlessDeployment(archive_path, platform, region,
                                              stage)
        elif platform == "aws-sagemaker":
            deployment = SagemakerDeployment(archive_path, api_name, region)
        else:
            _echo(
                "check deployment status with --platform=%s is not supported in the "
                "current version of BentoML" % platform,
                CLI_COLOR_ERROR,
            )
            return

        deployment.check_status()
Exemplo n.º 6
0
 def delete_deployment(archive_path, platform, region, stage, api_name):
     if platform in SERVERLESS_PLATFORMS:
         deployment = ServerlessDeployment(archive_path, platform, region, stage)
     elif platform == 'aws-sagemaker':
         deployment = SagemakerDeployment(archive_path, api_name, region)
     else:
         raise BentoMLException('Remove deployment with --platform=%s' % platform +
                                'is not supported in the current version of BentoML')
     result = deployment.delete()
     if result:
         _echo(
             'Delete {platform} deployment successful'.format(platform=platform))
     else:
         _echo(
             'Delete {platform} deployment unsuccessful'.format(platform=platform),
             CLICK_COLOR_ERROR)
     return
Exemplo n.º 7
0
    def deploy(archive_path, platform, region, stage, api_name, instance_type,
               instance_count):
        if platform in SERVERLESS_PLATFORMS:
            deployment = ServerlessDeployment(archive_path, platform, region,
                                              stage)
        elif platform == "aws-sagemaker":
            deployment = SagemakerDeployment(archive_path, api_name, region,
                                             instance_count, instance_type)
        else:
            _echo(
                "Deploying with --platform=%s is not supported in current version of "
                "BentoML" % platform,
                CLI_COLOR_ERROR,
            )
            return

        output_path = deployment.deploy()

        _echo(
            "Successfully deployed to {platform}!".format(platform=platform),
            CLI_COLOR_SUCCESS,
        )
        _echo("Deployment archive is saved at: %s" % output_path)