def test_yatai_server_with_sqlite_and_gcs(): gcs_bucket_name = 'gs://bentoml-e2e-tests/' with local_yatai_server(repo_base_url=gcs_bucket_name): logger.info('Saving bento service') svc = SampleBentoService() svc.save() bento_tag = f'{svc.name}:{svc.version}' logger.info('BentoService saved') logger.info("Display bentoservice info") bento = get_bento_service_info(svc.name, svc.version) logger.info(bento) assert (bento.uri.type == BentoUri.GCS ), 'BentoService storage type mismatched, expect GCS' retrieve_svc_result = execute_bentoml_retrieve_command( f'{svc.name}:{svc.version}') assert retrieve_svc_result.startswith( f'Service {svc.name} artifact directory') logger.info('Validate BentoService prediction result') run_result = execute_bentoml_run_command(bento_tag, '[]') logger.info(run_result) assert 'cat' in run_result, 'Unexpected BentoService prediction result' logger.info(f'Deleting saved bundle {bento_tag}') delete_svc_result = delete_bento(bento_tag) assert f"{bento_tag} deleted" in delete_svc_result
def test_yatai_server_with_sqlite_and_s3(): # Note: Use pre-existing bucket instead of newly created bucket, because the # bucket's global DNS needs time to get set up. # https://github.com/boto/boto3/issues/1982#issuecomment-511947643 s3_bucket_name = 's3://bentoml-e2e-test-repo/' with local_yatai_server(repo_base_url=s3_bucket_name): logger.info('Saving bento service') svc = SampleBentoService() svc.save() bento_tag = f'{svc.name}:{svc.version}' logger.info('BentoService saved') logger.info("Display bentoservice info") bento = get_bento_service_info(svc.name, svc.version) logger.info(bento) assert ( bento.uri.type == BentoUri.S3 ), 'BentoService storage type mismatched, expect S3' retrieve_svc_result = execute_bentoml_retrieve_command( f'{svc.name}:{svc.version}' ) assert retrieve_svc_result.startswith(f'Service {svc.name} artifact directory') logger.info('Validate BentoService prediction result') run_result = execute_bentoml_run_command(bento_tag, '[]') logger.info(run_result) assert 'cat' in run_result, 'Unexpected BentoService prediction result' logger.info(f'Deleting saved bundle {bento_tag}') delete_svc_result = delete_bento(bento_tag) assert f"{bento_tag} deleted" in delete_svc_result