-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
predictor.list_monitors() raises KeyError: 'NetworkConfig' when called on a (non-VPC) endpoint (PyTorch framework model, custom Docker monitoring job).
Per the MonitoringJobDefinition API doc, this field is optional in the response so should not be assumed.
To reproduce
Specifically I'm using the "Detecting and analyzing incorrect model predictions with Amazon SageMaker Model Monitor and Debugger" sample, and trying to re-attach to my endpoint's existing monitoring schedule after a kernel restart.
In general I expect you could:
- Deploy an endpoint not in a VPC, with no VPC/network configurations specified
- Attach a monitoring schedule, also with no VPC/network config
- call
predictor.list_monitors()
Expected behavior
List monitors regardless of whether NetworkConfig/VPC information is available
Screenshots or logs
Traceback:
~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/sagemaker/predictor.py in list_monitors(self)
358 ModelMonitor.attach(
359 monitor_schedule_name=schedule_name,
--> 360 sagemaker_session=self.sagemaker_session,
361 )
362 )
~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/sagemaker/model_monitor/model_monitoring.py in attach(cls, monitor_schedule_name, sagemaker_session)
680
681 vpc_config = schedule_desc["MonitoringScheduleConfig"]["MonitoringJobDefinition"][
--> 682 "NetworkConfig"
683 ].get("VpcConfig")
684
KeyError: 'NetworkConfig'
System information
A description of your system. Please provide:
- SageMaker Python SDK version: 2.9.1
- Framework name (eg. PyTorch) or algorithm (eg. KMeans): PyTorch
- Framework version: 1.3.1
- Python version: 3.6
- CPU or GPU: CPU
- Custom Docker image (Y/N): Y for processing job, N for endpoint
Additional context
None