Skip to content

Commit 0e24c9e

Browse files
authored
Merge branch 'master' into mask-creds-local-mode
2 parents cd69d31 + 17c6435 commit 0e24c9e

10 files changed

+23
-123
lines changed

buildspec-slowtests.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 0.2
2+
3+
phases:
4+
build:
5+
commands:
6+
- IGNORE_COVERAGE=-
7+
8+
# slow tests
9+
- start_time=`date +%s`
10+
- execute-command-if-has-matching-changes "tox -e py38 -- tests/integ -m slow_test -n 10 --durations 0" "tests/integ" "tests/data" "tests/conftest.py" "tests/__init__.py" "src/*.py" "setup.py" "setup.cfg" "buildspec-slowtests.yml"
11+
- ./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:

src/sagemaker/analytics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class AnalyticsMetricsBase(with_metaclass(ABCMeta, object)):
4343
"""
4444

4545
def __init__(self):
46+
"""Initializes ``AnalyticsMetricsBase`` instance."""
4647
self._dataframe = None
4748

4849
def export_csv(self, filename):

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 & 122 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.",
@@ -304,76 +305,6 @@ def test_run_bias_monitor(
304305
scheduled_bias_monitor.delete_monitoring_schedule()
305306

306307

307-
@pytest.mark.skipif(
308-
tests.integ.test_region() in tests.integ.NO_MODEL_MONITORING_REGIONS,
309-
reason="ModelMonitoring is not yet supported in this region.",
310-
)
311-
def test_run_bias_monitor_baseline(
312-
sagemaker_session,
313-
data_config,
314-
model_config,
315-
bias_config,
316-
model_predicted_label_config,
317-
endpoint_name,
318-
ground_truth_input,
319-
upload_actual_data,
320-
):
321-
monitor = ModelBiasMonitor(
322-
role=ROLE,
323-
instance_count=INSTANCE_COUNT,
324-
instance_type=INSTANCE_TYPE,
325-
volume_size_in_gb=VOLUME_SIZE_IN_GB,
326-
max_runtime_in_seconds=MAX_RUNTIME_IN_SECONDS,
327-
sagemaker_session=sagemaker_session,
328-
tags=TEST_TAGS,
329-
)
330-
331-
baselining_job_name = utils.unique_name_from_base("bias-baselining-job")
332-
print("Creating baselining job: {}".format(baselining_job_name))
333-
monitor.suggest_baseline(
334-
data_config=data_config,
335-
bias_config=bias_config,
336-
model_config=model_config,
337-
model_predicted_label_config=model_predicted_label_config,
338-
job_name=baselining_job_name,
339-
)
340-
assert (
341-
monitor.latest_baselining_job_config.probability_threshold_attribute
342-
== BIAS_PROBABILITY_THRESHOLD
343-
)
344-
monitoring_schedule_name = utils.unique_name_from_base("bias-suggest-baseline")
345-
s3_uri_monitoring_output = os.path.join(
346-
"s3://",
347-
sagemaker_session.default_bucket(),
348-
endpoint_name,
349-
monitoring_schedule_name,
350-
"monitor_output",
351-
)
352-
# Let's test if the schedule can pick up analysis_config from baselining job
353-
monitor.create_monitoring_schedule(
354-
output_s3_uri=s3_uri_monitoring_output,
355-
monitor_schedule_name=monitoring_schedule_name,
356-
endpoint_input=EndpointInput(
357-
endpoint_name=endpoint_name,
358-
destination=ENDPOINT_INPUT_LOCAL_PATH,
359-
start_time_offset=START_TIME_OFFSET,
360-
end_time_offset=END_TIME_OFFSET,
361-
),
362-
ground_truth_input=ground_truth_input,
363-
schedule_cron_expression=CRON,
364-
)
365-
_verify_execution_status(monitor)
366-
367-
_verify_bias_job_description(
368-
sagemaker_session=sagemaker_session,
369-
monitor=monitor,
370-
endpoint_name=endpoint_name,
371-
ground_truth_input=ground_truth_input,
372-
)
373-
374-
monitor.delete_monitoring_schedule()
375-
376-
377308
@pytest.fixture
378309
def explainability_monitor(sagemaker_session):
379310
monitor = ModelExplainabilityMonitor(
@@ -463,6 +394,7 @@ def test_explainability_monitor(sagemaker_session, scheduled_explainability_moni
463394
monitor.delete_monitoring_schedule()
464395

465396

397+
@pytest.mark.slow_test
466398
@pytest.mark.skipif(
467399
tests.integ.test_region() in tests.integ.NO_MODEL_MONITORING_REGIONS,
468400
reason="ModelMonitoring is not yet supported in this region.",
@@ -485,58 +417,6 @@ def test_run_explainability_monitor(
485417
scheduled_explainability_monitor.delete_monitoring_schedule()
486418

487419

488-
@pytest.mark.skipif(
489-
tests.integ.test_region() in tests.integ.NO_MODEL_MONITORING_REGIONS,
490-
reason="ModelMonitoring is not yet supported in this region.",
491-
)
492-
def test_run_explainability_monitor_baseline(
493-
sagemaker_session, shap_config, data_config, model_config, endpoint_name, upload_actual_data
494-
):
495-
monitor = ModelExplainabilityMonitor(
496-
role=ROLE,
497-
instance_count=INSTANCE_COUNT,
498-
instance_type=INSTANCE_TYPE,
499-
volume_size_in_gb=VOLUME_SIZE_IN_GB,
500-
max_runtime_in_seconds=MAX_RUNTIME_IN_SECONDS,
501-
sagemaker_session=sagemaker_session,
502-
tags=TEST_TAGS,
503-
)
504-
505-
baselining_job_name = utils.unique_name_from_base("explainability-baselining-job")
506-
print("Creating baselining job: {}".format(baselining_job_name))
507-
monitor.suggest_baseline(
508-
data_config=data_config,
509-
explainability_config=shap_config,
510-
model_config=model_config,
511-
job_name=baselining_job_name,
512-
)
513-
monitoring_schedule_name = utils.unique_name_from_base("explainability-suggest-baseline")
514-
s3_uri_monitoring_output = os.path.join(
515-
"s3://",
516-
sagemaker_session.default_bucket(),
517-
endpoint_name,
518-
monitoring_schedule_name,
519-
"monitor_output",
520-
)
521-
# Let's test if the schedule can pick up analysis_config from baselining job
522-
monitor.create_monitoring_schedule(
523-
output_s3_uri=s3_uri_monitoring_output,
524-
monitor_schedule_name=monitoring_schedule_name,
525-
endpoint_input=endpoint_name,
526-
schedule_cron_expression=CRON,
527-
)
528-
529-
_verify_execution_status(monitor)
530-
531-
_verify_explainability_job_description(
532-
sagemaker_session=sagemaker_session,
533-
monitor=monitor,
534-
endpoint_name=endpoint_name,
535-
)
536-
537-
monitor.delete_monitoring_schedule()
538-
539-
540420
def _verify_monitoring_schedule(monitor, schedule_status, schedule_cron_expression=CRON):
541421
desc = monitor.describe_schedule()
542422
assert desc["MonitoringScheduleName"] == monitor.monitoring_schedule_name

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_model_quality_monitor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ def test_run_model_quality_monitor(
254254
monitor.delete_monitoring_schedule()
255255

256256

257+
@pytest.mark.slow_test
257258
@pytest.mark.skipif(
258259
tests.integ.test_region() in tests.integ.NO_MODEL_MONITORING_REGIONS,
259260
reason="ModelMonitoring is not yet supported in this region.",

tests/integ/test_multidatamodel.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ def test_multi_data_model_deploy_pretrained_models_local_mode(container_image, s
262262
assert "Could not find endpoint" in str(exception.value)
263263

264264

265+
@pytest.mark.slow_test
265266
@pytest.mark.skipif(
266267
tests.integ.test_region() != "us-east-2",
267268
reason="Pulling the base image is currently limited to us-east-2.",
@@ -481,6 +482,7 @@ def __rcf_training_job(
481482
return rcf_model
482483

483484

485+
@pytest.mark.slow_test
484486
@pytest.mark.skipif(
485487
tests.integ.test_region() != "us-east-2",
486488
reason="Pulling the base image is currently limited to us-east-2.",

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_tuner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ def test_stop_tuning_job(sagemaker_session, cpu_instance_type):
523523
assert desc["HyperParameterTuningJobStatus"] == "Stopping"
524524

525525

526+
@pytest.mark.slow_test
526527
@pytest.mark.canary_quick
527528
def test_tuning_mxnet(
528529
sagemaker_session,

0 commit comments

Comments
 (0)