@@ -561,6 +561,8 @@ def create_monitoring_schedule(
561
561
schedule_cron_expression = None ,
562
562
enable_cloudwatch_metrics = True ,
563
563
batch_transform_input = None ,
564
+ data_analysis_start_time = None ,
565
+ data_analysis_end_time = None ,
564
566
):
565
567
"""Creates a monitoring schedule.
566
568
@@ -586,6 +588,10 @@ def create_monitoring_schedule(
586
588
the baselining or monitoring jobs. (default: True)
587
589
batch_transform_input (sagemaker.model_monitor.BatchTransformInput): Inputs to run
588
590
the monitoring schedule on the batch transform (default: None)
591
+ data_analysis_start_time (str): Start time for the data analysis window
592
+ for the one time monitoring schedule (NOW), e.g. "-PT1H" (default: None)
593
+ data_analysis_end_time (str): End time for the data analysis window
594
+ for the one time monitoring schedule (NOW), e.g. "-PT1H" (default: None)
589
595
"""
590
596
# we default ground_truth_input to None in the function signature
591
597
# but verify they are giving here for positional argument
@@ -610,6 +616,12 @@ def create_monitoring_schedule(
610
616
_LOGGER .error (message )
611
617
raise ValueError (message )
612
618
619
+ self ._check_monitoring_schedule_cron_validity (
620
+ schedule_cron_expression = schedule_cron_expression ,
621
+ data_analysis_start_time = data_analysis_start_time ,
622
+ data_analysis_end_time = data_analysis_end_time ,
623
+ )
624
+
613
625
# create job definition
614
626
monitor_schedule_name = self ._generate_monitoring_schedule_name (
615
627
schedule_name = monitor_schedule_name
@@ -649,6 +661,8 @@ def create_monitoring_schedule(
649
661
monitor_schedule_name = monitor_schedule_name ,
650
662
job_definition_name = new_job_definition_name ,
651
663
schedule_cron_expression = schedule_cron_expression ,
664
+ data_analysis_start_time = data_analysis_start_time ,
665
+ data_analysis_end_time = data_analysis_end_time ,
652
666
)
653
667
self .job_definition_name = new_job_definition_name
654
668
self .monitoring_schedule_name = monitor_schedule_name
@@ -684,6 +698,8 @@ def update_monitoring_schedule(
684
698
env = None ,
685
699
network_config = None ,
686
700
batch_transform_input = None ,
701
+ data_analysis_start_time = None ,
702
+ data_analysis_end_time = None ,
687
703
):
688
704
"""Updates the existing monitoring schedule.
689
705
@@ -778,7 +794,12 @@ def update_monitoring_schedule(
778
794
)
779
795
self .sagemaker_session .sagemaker_client .create_model_bias_job_definition (** request_dict )
780
796
try :
781
- self ._update_monitoring_schedule (new_job_definition_name , schedule_cron_expression )
797
+ self ._update_monitoring_schedule (
798
+ new_job_definition_name ,
799
+ schedule_cron_expression ,
800
+ data_analysis_start_time = data_analysis_start_time ,
801
+ data_analysis_end_time = data_analysis_end_time ,
802
+ )
782
803
self .job_definition_name = new_job_definition_name
783
804
if role is not None :
784
805
self .role = role
@@ -988,6 +1009,8 @@ def create_monitoring_schedule(
988
1009
schedule_cron_expression = None ,
989
1010
enable_cloudwatch_metrics = True ,
990
1011
batch_transform_input = None ,
1012
+ data_analysis_start_time = None ,
1013
+ data_analysis_end_time = None ,
991
1014
):
992
1015
"""Creates a monitoring schedule.
993
1016
@@ -1011,6 +1034,10 @@ def create_monitoring_schedule(
1011
1034
the baselining or monitoring jobs.
1012
1035
batch_transform_input (sagemaker.model_monitor.BatchTransformInput): Inputs to
1013
1036
run the monitoring schedule on the batch transform
1037
+ data_analysis_start_time (str): Start time for the data analysis window
1038
+ for the one time monitoring schedule (NOW), e.g. "-PT1H" (default: None)
1039
+ data_analysis_end_time (str): End time for the data analysis window
1040
+ for the one time monitoring schedule (NOW), e.g. "-PT1H" (default: None)
1014
1041
"""
1015
1042
if self .job_definition_name is not None or self .monitoring_schedule_name is not None :
1016
1043
message = (
@@ -1030,6 +1057,12 @@ def create_monitoring_schedule(
1030
1057
_LOGGER .error (message )
1031
1058
raise ValueError (message )
1032
1059
1060
+ self ._check_monitoring_schedule_cron_validity (
1061
+ schedule_cron_expression = schedule_cron_expression ,
1062
+ data_analysis_start_time = data_analysis_start_time ,
1063
+ data_analysis_end_time = data_analysis_end_time ,
1064
+ )
1065
+
1033
1066
# create job definition
1034
1067
monitor_schedule_name = self ._generate_monitoring_schedule_name (
1035
1068
schedule_name = monitor_schedule_name
@@ -1104,6 +1137,8 @@ def update_monitoring_schedule(
1104
1137
env = None ,
1105
1138
network_config = None ,
1106
1139
batch_transform_input = None ,
1140
+ data_analysis_start_time = None ,
1141
+ data_analysis_end_time = None ,
1107
1142
):
1108
1143
"""Updates the existing monitoring schedule.
1109
1144
@@ -1144,6 +1179,10 @@ def update_monitoring_schedule(
1144
1179
inter-container traffic, security group IDs, and subnets.
1145
1180
batch_transform_input (sagemaker.model_monitor.BatchTransformInput): Inputs to
1146
1181
run the monitoring schedule on the batch transform
1182
+ data_analysis_start_time (str): Start time for the data analysis window
1183
+ for the one time monitoring schedule (NOW), e.g. "-PT1H" (default: None)
1184
+ data_analysis_end_time (str): End time for the data analysis window
1185
+ for the one time monitoring schedule (NOW), e.g. "-PT1H" (default: None)
1147
1186
"""
1148
1187
valid_args = {
1149
1188
arg : value for arg , value in locals ().items () if arg != "self" and value is not None
@@ -1200,7 +1239,12 @@ def update_monitoring_schedule(
1200
1239
** request_dict
1201
1240
)
1202
1241
try :
1203
- self ._update_monitoring_schedule (new_job_definition_name , schedule_cron_expression )
1242
+ self ._update_monitoring_schedule (
1243
+ new_job_definition_name ,
1244
+ schedule_cron_expression ,
1245
+ data_analysis_start_time = data_analysis_start_time ,
1246
+ data_analysis_end_time = data_analysis_end_time ,
1247
+ )
1204
1248
self .job_definition_name = new_job_definition_name
1205
1249
if role is not None :
1206
1250
self .role = role
0 commit comments