Skip to content

KeyError: 'NetworkConfig' in predictor.list_monitors() #1910

Closed

Description

@athewsey

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

Activity

  1. athewsey commented on Sep 21, 2020

    @athewsey
    CollaboratorAuthor

    Update: This issue also appears to break ModelMonitor.attach() even if you're able to recover the monitoring schedule name via boto3.

  2. ajaykarpur commented on Oct 7, 2020

    @ajaykarpur
    Contributor

    A fix for this has been merged: #1911

    Pending release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions