Skip to content

Commit b6a735f

Browse files
committed
removed additional tests
1 parent 2b4dcf9 commit b6a735f

File tree

5 files changed

+15
-148
lines changed

5 files changed

+15
-148
lines changed

tests/integ/test_horovod.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,12 @@
2323
import sagemaker.utils
2424
import tests.integ as integ
2525
from sagemaker.tensorflow import TensorFlow
26-
from tests.integ import test_region, timeout, HOSTING_NO_P3_REGIONS
26+
from tests.integ import timeout
2727

2828
horovod_dir = os.path.join(os.path.dirname(__file__), "..", "data", "horovod")
2929

3030

31-
@pytest.fixture(
32-
scope="session",
33-
params=[
34-
"ml.c4.xlarge",
35-
pytest.param(
36-
"ml.p3.2xlarge",
37-
marks=pytest.mark.skipif(
38-
test_region() in HOSTING_NO_P3_REGIONS, reason="no ml.p3 instances in this region"
39-
),
40-
),
41-
],
42-
)
31+
@pytest.fixture(scope="session", params=["ml.c4.xlarge"])
4332
def instance_type(request):
4433
return request.param
4534

tests/integ/test_pytorch_train.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313
from __future__ import absolute_import
1414

1515
import os
16-
import time
1716

1817
import numpy
1918
import pytest
20-
import tests.integ
2119
from tests.integ import DATA_DIR, PYTHON_VERSION, TRAINING_DEFAULT_TIMEOUT_MINUTES
2220
from tests.integ.timeout import timeout, timeout_and_delete_endpoint_by_name
2321

@@ -80,42 +78,6 @@ def test_deploy_model(pytorch_training_job, sagemaker_session):
8078
assert output.shape == (batch_size, 10)
8179

8280

83-
@pytest.mark.skipif(
84-
tests.integ.test_region() in tests.integ.HOSTING_NO_P2_REGIONS
85-
or tests.integ.test_region() in tests.integ.TRAINING_NO_P2_REGIONS,
86-
reason="no ml.p2 instances in these regions",
87-
)
88-
def test_async_fit_deploy(sagemaker_session, pytorch_full_version):
89-
training_job_name = ""
90-
# TODO: add tests against local mode when it's ready to be used
91-
instance_type = "ml.p2.xlarge"
92-
93-
with timeout(minutes=10):
94-
pytorch = _get_pytorch_estimator(sagemaker_session, pytorch_full_version, instance_type)
95-
96-
pytorch.fit({"training": _upload_training_data(pytorch)}, wait=False)
97-
training_job_name = pytorch.latest_training_job.name
98-
99-
print("Waiting to re-attach to the training job: %s" % training_job_name)
100-
time.sleep(20)
101-
102-
if not _is_local_mode(instance_type):
103-
endpoint_name = "test-pytorch-async-fit-attach-deploy-{}".format(sagemaker_timestamp())
104-
105-
with timeout_and_delete_endpoint_by_name(endpoint_name, sagemaker_session):
106-
print("Re-attaching now to: %s" % training_job_name)
107-
estimator = PyTorch.attach(
108-
training_job_name=training_job_name, sagemaker_session=sagemaker_session
109-
)
110-
predictor = estimator.deploy(1, instance_type, endpoint_name=endpoint_name)
111-
112-
batch_size = 100
113-
data = numpy.random.rand(batch_size, 1, 28, 28).astype(numpy.float32)
114-
output = predictor.predict(data)
115-
116-
assert output.shape == (batch_size, 10)
117-
118-
11981
def _upload_training_data(pytorch):
12082
return pytorch.sagemaker_session.upload_data(
12183
path=os.path.join(MNIST_DIR, "training"),

tests/integ/test_tf_cifar.py

Lines changed: 0 additions & 83 deletions
This file was deleted.

tests/integ/test_tf_keras.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
@pytest.mark.skipif(
2929
tests.integ.PYTHON_VERSION != "py2", reason="TensorFlow image supports only python 2."
3030
)
31-
@pytest.mark.skipif(
32-
tests.integ.test_region() in tests.integ.HOSTING_NO_P2_REGIONS,
33-
reason="no ml.p2 instances in these regions",
34-
)
3531
def test_keras(sagemaker_session):
3632
script_path = os.path.join(tests.integ.DATA_DIR, "cifar_10", "source")
3733
dataset_path = os.path.join(tests.integ.DATA_DIR, "cifar_10", "data")
@@ -60,7 +56,7 @@ def test_keras(sagemaker_session):
6056

6157
endpoint_name = estimator.latest_training_job.name
6258
with timeout_and_delete_endpoint_by_name(endpoint_name, sagemaker_session):
63-
predictor = estimator.deploy(initial_instance_count=1, instance_type="ml.p2.xlarge")
59+
predictor = estimator.deploy(initial_instance_count=1, instance_type="ml.c4.xlarge")
6460

6561
data = np.random.randn(32, 32, 3)
6662
predict_response = predictor.predict(data)

tests/integ/test_tf_script_mode.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@
3838
TAGS = [{"Key": "some-key", "Value": "some-value"}]
3939

4040

41-
@pytest.fixture(
42-
scope="session",
43-
params=[
44-
"ml.c4.xlarge",
45-
],
46-
)
41+
@pytest.fixture(scope="session", params=["ml.c4.xlarge"])
4742
def instance_type(request):
4843
return request.param
4944

@@ -220,8 +215,15 @@ def _assert_s3_files_exist(s3_url, files):
220215
raise ValueError("File {} is not found under {}".format(f, s3_url))
221216

222217

223-
def _assert_tags_match(sagemaker_client, resource_arn, tags):
224-
actual_tags = sagemaker_client.list_tags(ResourceArn=resource_arn)["Tags"]
218+
def _assert_tags_match(sagemaker_client, resource_arn, tags, retries=1):
219+
actual_tags = None
220+
for _ in range(retries):
221+
actual_tags = sagemaker_client.list_tags(ResourceArn=resource_arn)["Tags"]
222+
if actual_tags:
223+
break
224+
else:
225+
# endpoint tags might take minutes to propagate. Sleeping.
226+
time.sleep(30)
225227
assert actual_tags == tags
226228

227229

@@ -232,7 +234,8 @@ def _assert_model_tags_match(sagemaker_client, model_name, tags):
232234

233235
def _assert_endpoint_tags_match(sagemaker_client, endpoint_name, tags):
234236
endpoint_description = sagemaker_client.describe_endpoint(EndpointName=endpoint_name)
235-
_assert_tags_match(sagemaker_client, endpoint_description["EndpointArn"], tags)
237+
238+
_assert_tags_match(sagemaker_client, endpoint_description["EndpointArn"], tags, retries=10)
236239

237240

238241
def _assert_training_job_tags_match(sagemaker_client, training_job_name, tags):

0 commit comments

Comments
 (0)