示例#1
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,
            )
示例#2
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