Skip to content

fix flaky tfs test #536

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

Closed
wants to merge 5 commits into from
Closed
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
18 changes: 10 additions & 8 deletions tests/integ/test_tfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,28 @@

import botocore.exceptions
import pytest

import sagemaker
import sagemaker.predictor
from sagemaker.tensorflow.serving import Model, Predictor
import sagemaker.utils
import tests.integ
import tests.integ.timeout
from sagemaker.tensorflow.serving import Model, Predictor


@pytest.fixture(scope='session', params=['ml.c5.xlarge', 'ml.p3.2xlarge'])
@pytest.fixture(scope='session', params=[
'ml.c5.xlarge',
pytest.param('ml.p3.2xlarge',
marks=pytest.mark.skipif(
tests.integ.REGION in tests.integ.HOSTING_P3_UNAVAILABLE_REGIONS,
reason='no ml.p3 instances in this region'))])
def instance_type(request):
return request.param


@pytest.fixture(scope='module')
def tfs_predictor(instance_type, sagemaker_session, tf_full_version):
endpoint_name = sagemaker.utils.name_from_base('sagemaker-tensorflow-serving')
endpoint_name = sagemaker.utils.unique_name_from_base('sagemaker-tensorflow-serving')
model_data = sagemaker_session.upload_data(
path='tests/data/tensorflow-serving-test-model.tar.gz',
key_prefix='tensorflow-serving/models')
Expand All @@ -42,11 +48,7 @@ def tfs_predictor(instance_type, sagemaker_session, tf_full_version):


@pytest.mark.continuous_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')

def test_predict(tfs_predictor, instance_type): # pylint: disable=W0613
input_data = {'instances': [1.0, 2.0, 5.0]}
expected_result = {'predictions': [3.5, 4.0, 5.5]}

Expand Down