@@ -958,6 +958,86 @@ def test_default_monitor_create_stop_and_start_monitoring_schedule_with_customiz
958958 my_default_monitor .stop_monitoring_schedule ()
959959
960960 _wait_for_schedule_changes_to_apply (monitor = my_default_monitor )
961+
962+
963+ @pytest .mark .skipif (
964+ tests .integ .test_region () in tests .integ .NO_MODEL_MONITORING_REGIONS ,
965+ reason = "ModelMonitoring is not yet supported in this region." ,
966+ )
967+ def test_default_monitor_create_stop_and_start_monitoring_schedule_with_dashboards (
968+ sagemaker_session , output_kms_key , volume_kms_key , predictor
969+ ):
970+
971+ my_default_monitor = DefaultModelMonitor (
972+ role = ROLE ,
973+ instance_count = INSTANCE_COUNT ,
974+ instance_type = INSTANCE_TYPE ,
975+ volume_size_in_gb = VOLUME_SIZE_IN_GB ,
976+ volume_kms_key = volume_kms_key ,
977+ output_kms_key = output_kms_key ,
978+ max_runtime_in_seconds = MAX_RUNTIME_IN_SECONDS ,
979+ sagemaker_session = sagemaker_session ,
980+ env = ENVIRONMENT ,
981+ tags = TAGS ,
982+ network_config = NETWORK_CONFIG ,
983+ )
984+
985+ output_s3_uri = os .path .join (
986+ "s3://" ,
987+ sagemaker_session .default_bucket (),
988+ INTEG_TEST_MONITORING_OUTPUT_BUCKET ,
989+ str (uuid .uuid4 ()),
990+ )
991+
992+ statistics = Statistics .from_file_path (
993+ statistics_file_path = os .path .join (tests .integ .DATA_DIR , "monitor/statistics.json" ),
994+ sagemaker_session = sagemaker_session ,
995+ )
996+
997+ constraints = Constraints .from_file_path (
998+ constraints_file_path = os .path .join (tests .integ .DATA_DIR , "monitor/constraints.json" ),
999+ sagemaker_session = sagemaker_session ,
1000+ )
1001+
1002+ my_default_monitor .create_monitoring_schedule (
1003+ endpoint_input = predictor .endpoint_name ,
1004+ output_s3_uri = output_s3_uri ,
1005+ statistics = statistics ,
1006+ constraints = constraints ,
1007+ schedule_cron_expression = CronExpressionGenerator .daily (),
1008+ enable_cloudwatch_metrics = ENABLE_CLOUDWATCH_METRICS ,
1009+ )
1010+
1011+ schedule_description = my_default_monitor .describe_schedule ()
1012+ _verify_default_monitoring_schedule (
1013+ sagemaker_session = sagemaker_session ,
1014+ schedule_description = schedule_description ,
1015+ statistics = statistics ,
1016+ constraints = constraints ,
1017+ output_kms_key = output_kms_key ,
1018+ volume_kms_key = volume_kms_key ,
1019+ network_config = NETWORK_CONFIG ,
1020+ )
1021+
1022+ _wait_for_schedule_changes_to_apply (monitor = my_default_monitor )
1023+
1024+ my_default_monitor .stop_monitoring_schedule ()
1025+
1026+ _wait_for_schedule_changes_to_apply (monitor = my_default_monitor )
1027+
1028+ stopped_schedule_description = my_default_monitor .describe_schedule ()
1029+ assert stopped_schedule_description ["MonitoringScheduleStatus" ] == "Stopped"
1030+
1031+ my_default_monitor .start_monitoring_schedule ()
1032+
1033+ _wait_for_schedule_changes_to_apply (monitor = my_default_monitor )
1034+
1035+ started_schedule_description = my_default_monitor .describe_schedule ()
1036+ assert started_schedule_description ["MonitoringScheduleStatus" ] == "Scheduled"
1037+
1038+ my_default_monitor .stop_monitoring_schedule ()
1039+
1040+ _wait_for_schedule_changes_to_apply (monitor = my_default_monitor )
9611041
9621042
9631043@pytest .mark .skipif (
0 commit comments