@@ -1599,7 +1599,7 @@ def _check_automatic_dashboard_validity(
15991599 dashboard_exists = True
16001600 try :
16011601 cw_client .get_dashboard (DashboardName = dashboard_name )
1602- except Exception as e :
1602+ except Exception as _ : # noqa: F841
16031603 dashboard_exists = False
16041604
16051605 if dashboard_exists :
@@ -2266,13 +2266,14 @@ def update_monitoring_schedule(
22662266 )
22672267 logger .error (message )
22682268 raise ValueError (message )
2269-
2269+
22702270 # error checking for dashboard
22712271 if enable_automatic_dashboard :
2272- self ._check_dashboard_validity_without_checking_in_use (
2272+ cw_client = self .sagemaker_session .boto_session .client ("cloudwatch" )
2273+ self ._check_automatic_dashboard_validity (
2274+ cw_client = cw_client ,
22732275 monitor_schedule_name = self .monitoring_schedule_name ,
22742276 enable_cloudwatch_metrics = enable_cloudwatch_metrics ,
2275- enable_automatic_dashboard = enable_automatic_dashboard ,
22762277 dashboard_name = dashboard_name ,
22772278 )
22782279
@@ -2405,7 +2406,7 @@ def update_monitoring_schedule(
24052406 )
24062407
24072408 self ._wait_for_schedule_changes_to_apply ()
2408-
2409+
24092410 if enable_automatic_dashboard :
24102411 if dashboard_name is None :
24112412 dashboard_name = self .monitoring_schedule_name
@@ -2425,7 +2426,6 @@ def update_monitoring_schedule(
24252426 ).to_json (),
24262427 )
24272428
2428-
24292429 def _update_data_quality_monitoring_schedule (
24302430 self ,
24312431 endpoint_input = None ,
@@ -2591,7 +2591,6 @@ def _update_data_quality_monitoring_schedule(
25912591 logger .exception (message )
25922592 raise
25932593
2594-
25952594 def delete_monitoring_schedule (self ):
25962595 """Deletes the monitoring schedule and its job definition."""
25972596 super (DefaultModelMonitor , self ).delete_monitoring_schedule ()
@@ -3473,10 +3472,11 @@ def update_monitoring_schedule(
34733472 raise ValueError (message )
34743473
34753474 if enable_automatic_dashboard :
3476- self ._check_dashboard_validity_without_checking_in_use (
3475+ cw_client = self .sagemaker_session .boto_session .client ("cloudwatch" )
3476+ self ._check_automatic_dashboard_validity (
3477+ cw_client = cw_client ,
34773478 monitor_schedule_name = self .monitoring_schedule_name ,
34783479 enable_cloudwatch_metrics = enable_cloudwatch_metrics ,
3479- enable_automatic_dashboard = enable_automatic_dashboard ,
34803480 dashboard_name = dashboard_name ,
34813481 )
34823482
0 commit comments