66
66
67
67
CRON = "cron(*/5 * * * ? *)"
68
68
UPDATED_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
71
71
ROLE = "SageMakerRole"
72
72
INSTANCE_COUNT = 1
73
73
INSTANCE_TYPE = "ml.c5.xlarge"
74
74
VOLUME_SIZE_IN_GB = 100
75
75
START_TIME_OFFSET = "-PT1H"
76
76
END_TIME_OFFSET = "-PT0H"
77
77
TEST_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
- )
87
78
88
79
89
80
@pytest .yield_fixture (scope = "module" )
@@ -203,10 +194,8 @@ def bias_monitor(sagemaker_session):
203
194
volume_size_in_gb = VOLUME_SIZE_IN_GB ,
204
195
max_runtime_in_seconds = MAX_RUNTIME_IN_SECONDS ,
205
196
sagemaker_session = sagemaker_session ,
206
- env = TEST_ENV ,
207
197
tags = TEST_TAGS ,
208
198
)
209
- monitor .image_uri = TEST_IMAGE_URI
210
199
return monitor
211
200
212
201
@@ -245,8 +234,8 @@ def scheduled_bias_monitor(
245
234
246
235
247
236
@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 ." ,
250
239
)
251
240
def test_bias_monitor (sagemaker_session , scheduled_bias_monitor , endpoint_name , ground_truth_input ):
252
241
monitor = scheduled_bias_monitor
@@ -297,8 +286,8 @@ def test_bias_monitor(sagemaker_session, scheduled_bias_monitor, endpoint_name,
297
286
298
287
299
288
@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 ." ,
302
291
)
303
292
def test_run_bias_monitor (
304
293
scheduled_bias_monitor , sagemaker_session , endpoint_name , ground_truth_input , upload_actual_data
@@ -316,8 +305,8 @@ def test_run_bias_monitor(
316
305
317
306
318
307
@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 ." ,
321
310
)
322
311
def test_run_bias_monitor_baseline (
323
312
sagemaker_session ,
@@ -336,10 +325,8 @@ def test_run_bias_monitor_baseline(
336
325
volume_size_in_gb = VOLUME_SIZE_IN_GB ,
337
326
max_runtime_in_seconds = MAX_RUNTIME_IN_SECONDS ,
338
327
sagemaker_session = sagemaker_session ,
339
- env = TEST_ENV ,
340
328
tags = TEST_TAGS ,
341
329
)
342
- monitor .image_uri = TEST_IMAGE_URI
343
330
344
331
baselining_job_name = utils .unique_name_from_base ("bias-baselining-job" )
345
332
print ("Creating baselining job: {}" .format (baselining_job_name ))
@@ -396,10 +383,8 @@ def explainability_monitor(sagemaker_session):
396
383
volume_size_in_gb = VOLUME_SIZE_IN_GB ,
397
384
max_runtime_in_seconds = MAX_RUNTIME_IN_SECONDS ,
398
385
sagemaker_session = sagemaker_session ,
399
- env = TEST_ENV ,
400
386
tags = TEST_TAGS ,
401
387
)
402
- monitor .image_uri = TEST_IMAGE_URI
403
388
return monitor
404
389
405
390
@@ -429,8 +414,8 @@ def scheduled_explainability_monitor(
429
414
430
415
431
416
@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 ." ,
434
419
)
435
420
def test_explainability_monitor (sagemaker_session , scheduled_explainability_monitor , endpoint_name ):
436
421
monitor = scheduled_explainability_monitor
@@ -479,8 +464,8 @@ def test_explainability_monitor(sagemaker_session, scheduled_explainability_moni
479
464
480
465
481
466
@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 ." ,
484
469
)
485
470
def test_run_explainability_monitor (
486
471
scheduled_explainability_monitor ,
@@ -501,8 +486,8 @@ def test_run_explainability_monitor(
501
486
502
487
503
488
@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 ." ,
506
491
)
507
492
def test_run_explainability_monitor_baseline (
508
493
sagemaker_session , shap_config , data_config , model_config , endpoint_name , upload_actual_data
@@ -514,10 +499,8 @@ def test_run_explainability_monitor_baseline(
514
499
volume_size_in_gb = VOLUME_SIZE_IN_GB ,
515
500
max_runtime_in_seconds = MAX_RUNTIME_IN_SECONDS ,
516
501
sagemaker_session = sagemaker_session ,
517
- env = TEST_ENV ,
518
502
tags = TEST_TAGS ,
519
503
)
520
- monitor .image_uri = TEST_IMAGE_URI
521
504
522
505
baselining_job_name = utils .unique_name_from_base ("explainability-baselining-job" )
523
506
print ("Creating baselining job: {}" .format (baselining_job_name ))
0 commit comments