def test_yatai_server_with_postgres_and_gcs(postgres_db_container_url): gcs_bucket_name = 'gs://bentoml-e2e-tests/' with local_yatai_server(db_url=postgres_db_container_url, 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") get_svc_result = get_bento_service_info(svc.name, svc.version) logger.info(get_svc_result) assert (get_svc_result.bento.uri.type == BentoUri.GCS ), 'BentoService storage type mismatched, expect GCS' logger.info('Validate BentoService prediction result') run_result = execute_bentoml_run_command(bento_tag, '[]') 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_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_postgres_and_s3(postgres_db_container_url): # 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(db_url=postgres_db_container_url, repo_base_url=s3_bucket_name) as yatai_service_url: yc = get_yatai_client(yatai_service_url) logger.info('Saving bento service') svc = SampleBentoService() svc.save(yatai_url=yatai_service_url) bento_tag = f'{svc.name}:{svc.version}' logger.info('BentoService saved') logger.info("Display bentoservice info") bento = yc.repository.get(bento_tag) logger.info(bento) assert (bento.uri.type == BentoUri.S3 ), 'BentoService storage type mismatched, expect S3' logger.info('Validate BentoService prediction result') run_result = execute_bentoml_run_command(bento_tag=bento_tag, data='[]', yatai_url=yatai_service_url) assert 'cat' in run_result, 'Unexpected BentoService prediction result' logger.info(f'Deleting saved bundle {bento_tag}') yc.repository.delete(bento_tag=bento_tag)
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) as yatai_service_url: yc = get_yatai_client(yatai_service_url) logger.info('Saving bento service') svc = SampleBentoService() svc.save(yatai_url=yatai_service_url) bento_tag = f'{svc.name}:{svc.version}' logger.info('BentoService saved') logger.info("Display bentoservice info") bento = yc.repository.get(bento_tag) logger.info(bento) assert (bento.uri.type == BentoUri.GCS ), 'BentoService storage type mismatched, expect GCS' logger.info('Validate BentoService prediction result') run_result = execute_bentoml_run_command(bento_tag=bento_tag, data='[]', yatai_url=yatai_service_url) logger.info(run_result) assert 'cat' in run_result, 'Unexpected BentoService prediction result' logger.info(f'Deleting saved bundle {bento_tag}') yc.repository.delete(bento_tag=bento_tag)
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
def test_yatai_server_with_sqlite_and_local_storage(): with local_yatai_server(): 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") get_svc_result = get_bento_service_info(svc.name, svc.version) logger.info(get_svc_result) assert (get_svc_result.bento.uri.type == BentoUri.LOCAL ), 'BentoService storage type mismatched, expect LOCAL' logger.info('Validate BentoService prediction result') run_result = execute_bentoml_run_command(bento_tag, '[]') 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