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, )
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
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)