6666
6767CRON = "cron(*/5 * * * ? *)"
6868UPDATED_CRON = CronExpressionGenerator .daily ()
69- MAX_RUNTIME_IN_SECONDS = 45 * 60
70- UPDATED_MAX_RUNTIME_IN_SECONDS = 60 * 60
69+ MAX_RUNTIME_IN_SECONDS = 30 * 60
70+ UPDATED_MAX_RUNTIME_IN_SECONDS = 25 * 60
7171ROLE = "SageMakerRole"
7272INSTANCE_COUNT = 1
7373INSTANCE_TYPE = "ml.c5.xlarge"
7474VOLUME_SIZE_IN_GB = 100
7575START_TIME_OFFSET = "-PT1H"
7676END_TIME_OFFSET = "-PT0H"
7777TEST_TAGS = [{"Key" : "integration" , "Value" : "test" }]
78- TEST_ENV = {"CLOUDWATCH_METRICS_DIRECTORY" : "/tmp" }
79-
80- # TODO: Use the same skipit mark as in test_model_monitor.py
81- TEST_REGSION = "us-west-2"
82- # TODO: Remove test image override once once 1p-registration went through.
83- # NOTE: The test account only has the image in us-west-2 and us-east-2
84- TEST_IMAGE_URI = "678264136642.dkr.ecr.{}.amazonaws.com/sagemaker-xai-analyzer:1.0" .format (
85- TEST_REGSION
86- )
8778
8879
8980@pytest .yield_fixture (scope = "module" )
@@ -203,10 +194,8 @@ def bias_monitor(sagemaker_session):
203194 volume_size_in_gb = VOLUME_SIZE_IN_GB ,
204195 max_runtime_in_seconds = MAX_RUNTIME_IN_SECONDS ,
205196 sagemaker_session = sagemaker_session ,
206- env = TEST_ENV ,
207197 tags = TEST_TAGS ,
208198 )
209- monitor .image_uri = TEST_IMAGE_URI
210199 return monitor
211200
212201
@@ -245,8 +234,8 @@ def scheduled_bias_monitor(
245234
246235
247236@pytest .mark .skipif (
248- tests .integ .test_region () != TEST_REGSION ,
249- reason = "Image is not yet available in certain regions ." ,
237+ tests .integ .test_region () in tests . integ . NO_MODEL_MONITORING_REGIONS ,
238+ reason = "ModelMonitoring is not yet supported in this region ." ,
250239)
251240def test_bias_monitor (sagemaker_session , scheduled_bias_monitor , endpoint_name , ground_truth_input ):
252241 monitor = scheduled_bias_monitor
@@ -297,8 +286,8 @@ def test_bias_monitor(sagemaker_session, scheduled_bias_monitor, endpoint_name,
297286
298287
299288@pytest .mark .skipif (
300- tests .integ .test_region () != TEST_REGSION ,
301- reason = "Image is not yet available in certain regions ." ,
289+ tests .integ .test_region () in tests . integ . NO_MODEL_MONITORING_REGIONS ,
290+ reason = "ModelMonitoring is not yet supported in this region ." ,
302291)
303292def test_run_bias_monitor (
304293 scheduled_bias_monitor , sagemaker_session , endpoint_name , ground_truth_input , upload_actual_data
@@ -316,8 +305,8 @@ def test_run_bias_monitor(
316305
317306
318307@pytest .mark .skipif (
319- tests .integ .test_region () != TEST_REGSION ,
320- reason = "Image is not yet available in certain regions ." ,
308+ tests .integ .test_region () in tests . integ . NO_MODEL_MONITORING_REGIONS ,
309+ reason = "ModelMonitoring is not yet supported in this region ." ,
321310)
322311def test_run_bias_monitor_baseline (
323312 sagemaker_session ,
@@ -336,10 +325,8 @@ def test_run_bias_monitor_baseline(
336325 volume_size_in_gb = VOLUME_SIZE_IN_GB ,
337326 max_runtime_in_seconds = MAX_RUNTIME_IN_SECONDS ,
338327 sagemaker_session = sagemaker_session ,
339- env = TEST_ENV ,
340328 tags = TEST_TAGS ,
341329 )
342- monitor .image_uri = TEST_IMAGE_URI
343330
344331 baselining_job_name = utils .unique_name_from_base ("bias-baselining-job" )
345332 print ("Creating baselining job: {}" .format (baselining_job_name ))
@@ -396,10 +383,8 @@ def explainability_monitor(sagemaker_session):
396383 volume_size_in_gb = VOLUME_SIZE_IN_GB ,
397384 max_runtime_in_seconds = MAX_RUNTIME_IN_SECONDS ,
398385 sagemaker_session = sagemaker_session ,
399- env = TEST_ENV ,
400386 tags = TEST_TAGS ,
401387 )
402- monitor .image_uri = TEST_IMAGE_URI
403388 return monitor
404389
405390
@@ -429,8 +414,8 @@ def scheduled_explainability_monitor(
429414
430415
431416@pytest .mark .skipif (
432- tests .integ .test_region () != TEST_REGSION ,
433- reason = "Image is not yet available in certain regions ." ,
417+ tests .integ .test_region () in tests . integ . NO_MODEL_MONITORING_REGIONS ,
418+ reason = "ModelMonitoring is not yet supported in this region ." ,
434419)
435420def test_explainability_monitor (sagemaker_session , scheduled_explainability_monitor , endpoint_name ):
436421 monitor = scheduled_explainability_monitor
@@ -479,8 +464,8 @@ def test_explainability_monitor(sagemaker_session, scheduled_explainability_moni
479464
480465
481466@pytest .mark .skipif (
482- tests .integ .test_region () != TEST_REGSION ,
483- reason = "Image is not yet available in certain regions ." ,
467+ tests .integ .test_region () in tests . integ . NO_MODEL_MONITORING_REGIONS ,
468+ reason = "ModelMonitoring is not yet supported in this region ." ,
484469)
485470def test_run_explainability_monitor (
486471 scheduled_explainability_monitor ,
@@ -501,8 +486,8 @@ def test_run_explainability_monitor(
501486
502487
503488@pytest .mark .skipif (
504- tests .integ .test_region () != TEST_REGSION ,
505- reason = "Image is not yet available in certain regions ." ,
489+ tests .integ .test_region () in tests . integ . NO_MODEL_MONITORING_REGIONS ,
490+ reason = "ModelMonitoring is not yet supported in this region ." ,
506491)
507492def test_run_explainability_monitor_baseline (
508493 sagemaker_session , shap_config , data_config , model_config , endpoint_name , upload_actual_data
@@ -514,10 +499,8 @@ def test_run_explainability_monitor_baseline(
514499 volume_size_in_gb = VOLUME_SIZE_IN_GB ,
515500 max_runtime_in_seconds = MAX_RUNTIME_IN_SECONDS ,
516501 sagemaker_session = sagemaker_session ,
517- env = TEST_ENV ,
518502 tags = TEST_TAGS ,
519503 )
520- monitor .image_uri = TEST_IMAGE_URI
521504
522505 baselining_job_name = utils .unique_name_from_base ("explainability-baselining-job" )
523506 print ("Creating baselining job: {}" .format (baselining_job_name ))
0 commit comments