63
63
)
64
64
"encrypt_inter_container_traffic=None when creating your NetworkConfig object."
65
65
66
+ MONITORING_SCHEDULE_DESC = {
67
+ "MonitoringScheduleArn" : "arn:aws:monitoring-schedule" ,
68
+ "MonitoringScheduleName" : "my-monitoring-schedule" ,
69
+ "MonitoringScheduleConfig" : {
70
+ "MonitoringJobDefinition" : {
71
+ "MonitoringOutputConfig" : {},
72
+ "MonitoringResources" : {
73
+ "ClusterConfig" : {
74
+ "InstanceCount" : 1 ,
75
+ "InstanceType" : "ml.t3.medium" ,
76
+ "VolumeSizeInGB" : 8 ,
77
+ }
78
+ },
79
+ "MonitoringAppSpecification" : {
80
+ "ImageUri" : "image-uri" ,
81
+ "ContainerEntrypoint" : [
82
+ "entrypoint.py" ,
83
+ ],
84
+ },
85
+ "RoleArn" : ROLE ,
86
+ }
87
+ },
88
+ "EndpointName" : "my-endpoint" ,
89
+ }
90
+
66
91
67
92
# TODO-reinvent-2019: Continue to flesh these out.
68
93
@pytest .fixture ()
@@ -80,6 +105,9 @@ def sagemaker_session():
80
105
name = "upload_data" , return_value = "mocked_s3_uri_from_upload_data"
81
106
)
82
107
session_mock .download_data = Mock (name = "download_data" )
108
+ session_mock .describe_monitoring_schedule = Mock (
109
+ name = "describe_monitoring_schedule" , return_value = MONITORING_SCHEDULE_DESC
110
+ )
83
111
return session_mock
84
112
85
113
@@ -153,6 +181,17 @@ def test_default_model_monitor_with_invalid_network_config(sagemaker_session):
153
181
assert INTER_CONTAINER_ENCRYPTION_EXCEPTION_MSG in str (exception .value )
154
182
155
183
184
+ def test_model_monitor_without_network_config (sagemaker_session ):
185
+ my_model_monitor = ModelMonitor (
186
+ role = ROLE ,
187
+ image_uri = CUSTOM_IMAGE_URI ,
188
+ sagemaker_session = sagemaker_session ,
189
+ )
190
+ model_monitor_schedule_name = "model-monitoring-without-netwotk-config"
191
+ attached = my_model_monitor .attach (model_monitor_schedule_name , sagemaker_session )
192
+ assert attached .network_config is None
193
+
194
+
156
195
def test_model_monitor_with_invalid_network_config (sagemaker_session ):
157
196
invalid_network_config = NetworkConfig (encrypt_inter_container_traffic = False )
158
197
my_model_monitor = ModelMonitor (
0 commit comments