Skip to content

add canary tests for tf serving container #478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/integ/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@
PYTHON_VERSION = 'py' + str(sys.version_info.major)
REGION = boto3.session.Session().region_name

HOSTING_P2_UNAVAILABLE_REGIONS = ['ca-central-1', 'us-west-1', 'eu-west-2']
HOSTING_P3_UNAVAILABLE_REGIONS = ['ap-southeast-1', 'ap-southeast-2', 'ap-south-1', 'ca-central-1',
'us-west-1']

logging.getLogger('boto3').setLevel(logging.INFO)
logging.getLogger('botocore').setLevel(logging.INFO)
15 changes: 10 additions & 5 deletions tests/integ/test_tfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
import sagemaker
import sagemaker.predictor
import sagemaker.utils
import tests.integ
import tests.integ.timeout
from sagemaker.tensorflow.serving import Model, Predictor
from tests.integ.timeout import timeout_and_delete_endpoint_by_name


@pytest.fixture(scope='session', params=['ml.c5.xlarge', 'ml.p3.2xlarge'])
Expand All @@ -32,17 +33,21 @@ def tfs_predictor(instance_type, sagemaker_session, tf_full_version):
model_data = sagemaker_session.upload_data(
path='tests/data/tensorflow-serving-test-model.tar.gz',
key_prefix='tensorflow-serving/models')
with timeout_and_delete_endpoint_by_name(endpoint_name, sagemaker_session):
with tests.integ.timeout.timeout_and_delete_endpoint_by_name(endpoint_name, sagemaker_session):
model = Model(model_data=model_data, role='SageMakerRole',
framework_version=tf_full_version,
sagemaker_session=sagemaker_session)
predictor = model.deploy(1, instance_type, endpoint_name=endpoint_name)
yield predictor


# @pytest.mark.continuous_testing
# @pytest.mark.regional_testing
def test_predict(tfs_predictor):
@pytest.mark.continuous_testing
@pytest.mark.regional_testing
def test_predict(tfs_predictor, instance_type):
if ('p3' in instance_type) and (
tests.integ.REGION in tests.integ.HOSTING_P3_UNAVAILABLE_REGIONS):
pytest.skip('no ml.p3 instances in this region')

input_data = {'instances': [1.0, 2.0, 5.0]}
expected_result = {'predictions': [3.5, 4.0, 5.5]}

Expand Down