Skip to content

Commit 0ac104d

Browse files
authored
Merge branch 'master' into enable-step-caching
2 parents 486362b + 4634951 commit 0ac104d

21 files changed

+78
-32
lines changed

buildspec-slowtests.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 0.2
2+
3+
phases:
4+
pre_build:
5+
commands:
6+
- start-dockerd
7+
8+
build:
9+
commands:
10+
- IGNORE_COVERAGE=-
11+
12+
# slow tests
13+
- start_time=`date +%s`
14+
- execute-command-if-has-matching-changes "tox -e py38 -- tests/integ -m slow_test -n 16 --durations 0" "tests/integ" "tests/data" "tests/conftest.py" "tests/__init__.py" "src/*.py" "setup.py" "setup.cfg" "buildspec-slowtests.yml"
15+
- ./ci-scripts/displaytime.sh 'py38 slow tests' $start_time

buildspec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ phases:
1616

1717
- start_time=`date +%s`
1818
- |
19-
execute-command-if-has-matching-changes "env -u AWS_DEFAULT_REGION tox -e py38 -- tests/integ -m \"not local_mode and not cron\" -n 384 --reruns 3 --reruns-delay 15 --durations 50 --boto-config '{\"region_name\": \"us-east-2\"}'" "tests/integ" "tests/scripts" "tests/data" "tests/conftest.py" "tests/__init__.py" "src/*.py" "src/sagemaker/image_uri_config/*.json" "setup.py" "setup.cfg" "buildspec.yml"
19+
execute-command-if-has-matching-changes "env -u AWS_DEFAULT_REGION tox -e py38 -- tests/integ -m \"not local_mode and not cron and not slow_test\" -n 384 --reruns 3 --reruns-delay 15 --durations 50 --boto-config '{\"region_name\": \"us-east-2\"}'" "tests/integ" "tests/scripts" "tests/data" "tests/conftest.py" "tests/__init__.py" "src/*.py" "src/sagemaker/image_uri_config/*.json" "setup.py" "setup.cfg" "buildspec.yml"
2020
- ./ci-scripts/displaytime.sh 'py38 tests/integ' $start_time
2121

2222
post_build:

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def read_version():
6666
"pytest<6.1.0",
6767
"pytest-cov",
6868
"pytest-rerunfailures",
69+
"pytest-timeout",
6970
"pytest-xdist",
7071
"mock",
7172
"contextlib2",

src/sagemaker/image_uris.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ def retrieve(
9898
"mxnet-1.8.0-gpu-py37": "cu110-ubuntu16.04",
9999
"pytorch-1.6-gpu-py36": "cu110-ubuntu18.04-v3",
100100
"pytorch-1.6.0-gpu-py36": "cu110-ubuntu18.04",
101+
"pytorch-1.6-gpu-py3": "cu110-ubuntu18.04-v3",
102+
"pytorch-1.6.0-gpu-py3": "cu110-ubuntu18.04",
101103
}
102104
key = "-".join([framework, tag])
103105
if key in container_versions:

tests/data/multimodel/container/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM 142577830533.dkr.ecr.us-east-2.amazonaws.com/ubuntu:16.04
1+
FROM public.ecr.aws/ubuntu/ubuntu:18.04
22

33
# Set a docker label to advertise multi-model support on the container
44
LABEL com.amazonaws.sagemaker.capabilities.multi-models=true
@@ -15,7 +15,7 @@ RUN apt-get update && \
1515
curl \
1616
vim \
1717
&& rm -rf /var/lib/apt/lists/* \
18-
&& curl -O https://bootstrap.pypa.io/3.5/get-pip.py \
18+
&& curl -O https://bootstrap.pypa.io/get-pip.py \
1919
&& python3 get-pip.py
2020

2121
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1

tests/integ/sagemaker/lineage/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ def artifact_obj_with_association(sagemaker_session, artifact_obj):
155155
@pytest.fixture
156156
def trial_component_obj(sagemaker_session):
157157
trial_component_obj = trial_component.TrialComponent.create(
158-
trial_component_name=name(), sagemaker_boto_client=sagemaker_session.sagemaker_client
158+
trial_component_name=name(),
159+
sagemaker_boto_client=sagemaker_session.sagemaker_client,
159160
)
160161
yield trial_component_obj
161162
time.sleep(0.5)

tests/integ/sagemaker/lineage/test_action.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
import datetime
1717
import logging
18+
import time
19+
20+
import pytest
1821

1922
from sagemaker.lineage import action
2023

@@ -80,6 +83,7 @@ def test_list(action_objs, sagemaker_session):
8083
assert action_names
8184

8285

86+
@pytest.mark.timeout(30)
8387
def test_tag(action_obj, sagemaker_session):
8488
tag = {"Key": "foo", "Value": "bar"}
8589
action_obj.set_tag(tag)
@@ -90,12 +94,14 @@ def test_tag(action_obj, sagemaker_session):
9094
)["Tags"]
9195
if actual_tags:
9296
break
97+
time.sleep(5)
9398
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
9499
# length of actual tags will be greater than 1
95100
assert len(actual_tags) > 0
96101
assert actual_tags[0] == tag
97102

98103

104+
@pytest.mark.timeout(30)
99105
def test_tags(action_obj, sagemaker_session):
100106
tags = [{"Key": "foo1", "Value": "bar1"}]
101107
action_obj.set_tags(tags)
@@ -106,6 +112,7 @@ def test_tags(action_obj, sagemaker_session):
106112
)["Tags"]
107113
if actual_tags:
108114
break
115+
time.sleep(5)
109116
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
110117
# length of actual tags will be greater than 1
111118
assert len(actual_tags) > 0

tests/integ/sagemaker/lineage/test_artifact.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import logging
1818
import time
1919

20+
import pytest
21+
2022
from sagemaker.lineage import artifact
2123

2224

@@ -111,6 +113,7 @@ def test_downstream_trials(trial_associated_artifact, trial_obj, sagemaker_sessi
111113
assert trial_obj.trial_name in trials
112114

113115

116+
@pytest.mark.timeout(30)
114117
def test_tag(artifact_obj, sagemaker_session):
115118
tag = {"Key": "foo", "Value": "bar"}
116119
artifact_obj.set_tag(tag)
@@ -121,12 +124,14 @@ def test_tag(artifact_obj, sagemaker_session):
121124
)["Tags"]
122125
if actual_tags:
123126
break
127+
time.sleep(5)
124128
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
125129
# length of actual tags will be greater than 1
126130
assert len(actual_tags) > 0
127131
assert actual_tags[0] == tag
128132

129133

134+
@pytest.mark.timeout(30)
130135
def test_tags(artifact_obj, sagemaker_session):
131136
tags = [{"Key": "foo1", "Value": "bar1"}]
132137
artifact_obj.set_tags(tags)
@@ -137,6 +142,7 @@ def test_tags(artifact_obj, sagemaker_session):
137142
)["Tags"]
138143
if actual_tags:
139144
break
145+
time.sleep(5)
140146
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
141147
# length of actual tags will be greater than 1
142148
assert len(actual_tags) > 0

tests/integ/sagemaker/lineage/test_association.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import datetime
1717
import time
1818

19+
import pytest
20+
1921
from sagemaker.lineage import association
2022

2123

@@ -55,6 +57,7 @@ def test_list(association_objs, sagemaker_session):
5557
assert association_keys_listed
5658

5759

60+
@pytest.mark.timeout(30)
5861
def test_set_tag(association_obj, sagemaker_session):
5962
tag = {"Key": "foo", "Value": "bar"}
6063
association_obj.set_tag(tag)
@@ -65,13 +68,14 @@ def test_set_tag(association_obj, sagemaker_session):
6568
)["Tags"]
6669
if actual_tags:
6770
break
68-
time.sleep(1)
71+
time.sleep(5)
6972
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
7073
# length of actual tags will be greater than 1
7174
assert len(actual_tags) > 0
7275
assert actual_tags[0] == tag
7376

7477

78+
@pytest.mark.timeout(30)
7579
def test_tags(association_obj, sagemaker_session):
7680
tags = [{"Key": "foo1", "Value": "bar1"}]
7781
association_obj.set_tags(tags)
@@ -82,7 +86,7 @@ def test_tags(association_obj, sagemaker_session):
8286
)["Tags"]
8387
if actual_tags:
8488
break
85-
time.sleep(1)
89+
time.sleep(5)
8690
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
8791
# length of actual tags will be greater than 1
8892
assert len(actual_tags) > 0

tests/integ/sagemaker/lineage/test_context.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
import datetime
1717
import logging
18+
import time
19+
20+
import pytest
1821

1922
from sagemaker.lineage import context
2023

@@ -78,6 +81,7 @@ def test_list(context_objs, sagemaker_session):
7881
assert context_names
7982

8083

84+
@pytest.mark.timeout(30)
8185
def test_tag(context_obj, sagemaker_session):
8286
tag = {"Key": "foo", "Value": "bar"}
8387
context_obj.set_tag(tag)
@@ -88,12 +92,14 @@ def test_tag(context_obj, sagemaker_session):
8892
)["Tags"]
8993
if actual_tags:
9094
break
95+
time.sleep(5)
9196
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
9297
# length of actual tags will be greater than 1
9398
assert len(actual_tags) > 0
9499
assert actual_tags[0] == tag
95100

96101

102+
@pytest.mark.timeout(30)
97103
def test_tags(context_obj, sagemaker_session):
98104
tags = [{"Key": "foo1", "Value": "bar1"}]
99105
context_obj.set_tags(tags)
@@ -104,6 +110,7 @@ def test_tags(context_obj, sagemaker_session):
104110
)["Tags"]
105111
if actual_tags:
106112
break
113+
time.sleep(5)
107114
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
108115
# length of actual tags will be greater than 1
109116
assert len(actual_tags) > 0

tests/integ/test_auto_ml.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
}
4848

4949

50+
@pytest.mark.slow_test
5051
@pytest.mark.skipif(
5152
tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS,
5253
reason="AutoML is not supported in the region yet.",

tests/integ/test_clarify_model_monitor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ def test_bias_monitor(sagemaker_session, scheduled_bias_monitor, endpoint_name,
285285
monitor.delete_monitoring_schedule()
286286

287287

288+
@pytest.mark.slow_test
288289
@pytest.mark.skipif(
289290
tests.integ.test_region() in tests.integ.NO_MODEL_MONITORING_REGIONS,
290291
reason="ModelMonitoring is not yet supported in this region.",
@@ -393,6 +394,7 @@ def test_explainability_monitor(sagemaker_session, scheduled_explainability_moni
393394
monitor.delete_monitoring_schedule()
394395

395396

397+
@pytest.mark.slow_test
396398
@pytest.mark.skipif(
397399
tests.integ.test_region() in tests.integ.NO_MODEL_MONITORING_REGIONS,
398400
reason="ModelMonitoring is not yet supported in this region.",

tests/integ/test_inference_pipeline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def test_inference_pipeline_model_deploy(sagemaker_session, cpu_instance_type):
149149
assert "Could not find model" in str(exception.value)
150150

151151

152+
@pytest.mark.slow_test
152153
def test_inference_pipeline_model_deploy_and_update_endpoint(
153154
sagemaker_session, cpu_instance_type, alternative_cpu_instance_type
154155
):

tests/integ/test_lda.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from tests.integ.record_set import prepare_record_set_from_local_files
2727

2828

29+
@pytest.mark.slow_test
2930
@pytest.mark.skipif(
3031
tests.integ.test_region() in tests.integ.NO_LDA_REGIONS,
3132
reason="LDA image is not supported in certain regions",

tests/integ/test_model_quality_monitor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def test_model_quality_monitor(
230230
monitor.delete_monitoring_schedule()
231231

232232

233+
@pytest.mark.slow_test
233234
@pytest.mark.skipif(
234235
tests.integ.test_region() in tests.integ.NO_MODEL_MONITORING_REGIONS,
235236
reason="ModelMonitoring is not yet supported in this region.",
@@ -254,6 +255,7 @@ def test_run_model_quality_monitor(
254255
monitor.delete_monitoring_schedule()
255256

256257

258+
@pytest.mark.slow_test
257259
@pytest.mark.skipif(
258260
tests.integ.test_region() in tests.integ.NO_MODEL_MONITORING_REGIONS,
259261
reason="ModelMonitoring is not yet supported in this region.",

tests/integ/test_multidatamodel.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import pytest
2323
from botocore.exceptions import ClientError
2424

25-
import tests
26-
2725
from sagemaker import utils
2826
from sagemaker.amazon.randomcutforest import RandomCutForest
2927
from sagemaker.deserializers import StringDeserializer
@@ -53,10 +51,6 @@ def container_image(sagemaker_session):
5351

5452
docker_client = docker.from_env()
5553

56-
# Base image pull
57-
base_image = "142577830533.dkr.ecr.us-east-2.amazonaws.com/ubuntu:16.04"
58-
docker_client.images.pull(base_image, auth_config={"username": username, "password": password})
59-
6054
# Build and tag docker image locally
6155
image, build_log = docker_client.images.build(
6256
path=os.path.join(DATA_DIR, "multimodel", "container"),
@@ -134,10 +128,6 @@ def _ecr_login(ecr_client):
134128
return username, password
135129

136130

137-
@pytest.mark.skipif(
138-
tests.integ.test_region() != "us-east-2",
139-
reason="Pulling the base image is currently limited to us-east-2.",
140-
)
141131
def test_multi_data_model_deploy_pretrained_models(
142132
container_image, sagemaker_session, cpu_instance_type
143133
):
@@ -198,10 +188,6 @@ def test_multi_data_model_deploy_pretrained_models(
198188

199189

200190
@pytest.mark.local_mode
201-
@pytest.mark.skipif(
202-
tests.integ.test_region() != "us-east-2",
203-
reason="Pulling the base image is currently limited to us-east-2.",
204-
)
205191
def test_multi_data_model_deploy_pretrained_models_local_mode(container_image, sagemaker_session):
206192
timestamp = sagemaker_timestamp()
207193
endpoint_name = "test-multimodel-endpoint-{}".format(timestamp)
@@ -262,10 +248,6 @@ def test_multi_data_model_deploy_pretrained_models_local_mode(container_image, s
262248
assert "Could not find endpoint" in str(exception.value)
263249

264250

265-
@pytest.mark.skipif(
266-
tests.integ.test_region() != "us-east-2",
267-
reason="Pulling the base image is currently limited to us-east-2.",
268-
)
269251
def test_multi_data_model_deploy_trained_model_from_framework_estimator(
270252
container_image,
271253
sagemaker_session,
@@ -380,10 +362,7 @@ def _mxnet_training_job(
380362
return mx.create_model(image_uri=container_image)
381363

382364

383-
@pytest.mark.skipif(
384-
tests.integ.test_region() != "us-east-2",
385-
reason="Pulling the base image is currently limited to us-east-2.",
386-
)
365+
@pytest.mark.slow_test
387366
def test_multi_data_model_deploy_train_model_from_amazon_first_party_estimator(
388367
container_image, sagemaker_session, cpu_instance_type
389368
):
@@ -481,10 +460,6 @@ def __rcf_training_job(
481460
return rcf_model
482461

483462

484-
@pytest.mark.skipif(
485-
tests.integ.test_region() != "us-east-2",
486-
reason="Pulling the base image is currently limited to us-east-2.",
487-
)
488463
def test_multi_data_model_deploy_pretrained_models_update_endpoint(
489464
container_image, sagemaker_session, cpu_instance_type, alternative_cpu_instance_type
490465
):

tests/integ/test_mxnet.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def test_attach_deploy(mxnet_training_job, sagemaker_session, cpu_instance_type)
8383
assert result is not None
8484

8585

86+
@pytest.mark.slow_test
8687
def test_deploy_estimator_with_different_instance_types(
8788
mxnet_training_job,
8889
sagemaker_session,
@@ -258,6 +259,7 @@ def test_deploy_model_with_tags_and_kms(
258259
assert endpoint_config["KmsKeyId"] == kms_key_arn
259260

260261

262+
@pytest.mark.slow_test
261263
def test_deploy_model_and_update_endpoint(
262264
mxnet_training_job,
263265
sagemaker_session,

tests/integ/test_tf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ def test_mnist_distributed(
155155
)
156156

157157

158+
@pytest.mark.slow_test
158159
def test_mnist_async(sagemaker_session, cpu_instance_type, tf_full_version, tf_full_py_version):
159160
estimator = TensorFlow(
160161
entry_point=SCRIPT,

0 commit comments

Comments
 (0)