MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.14k stars 21.25k forks source link

The SDK Code Example Under "Set up out-of-the-box model monitoring" Has Errors #118136

Open sraza-onshape opened 7 months ago

sraza-onshape commented 7 months ago

Under the heading "Set up out-of-the-box model monitoring", I have spotted 3 issues in trying to use the example implementation (that uses the Python SDK for Azure ML):

HttpResponseError: (UserError) $"The value for '.emails' is missing."
Code: UserError
Message: $"The value for '.emails' is missing."
Additional Information:Type: ComponentName
Info: {
    "value": "managementfrontend"
}Type: Correlation
Info: {
    "value": {
        "operation": "368933adbef94b56b3119f838d72e8ae",
        "request": "d19404bf2c2d54f6"
    }
}Type: Environment
Info: {
    "value": "eastus2"
}Type: Location
Info: {
    "value": "eastus2"
}Type: Time
Info: {
    "value": "2023-12-18T22:43:23.3580957+00:00"
}Type: InnerError
Info: {
    "value": {
        "code": "BadArgument",
        "innerError": {
            "code": "ArgumentInvalid",
            "innerError": {
                "code": "MissingArgument",
                "innerError": null
            }
        }
    }
}

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

ahughes-msft commented 7 months ago

Hi @sraza-onshape Thank you for looking into this and providing your feedback. Issues 1 and 2 we will address in an upcoming documentation update.

For issue 3, I may need more information to debug it. Can you please share the SDK code you are using?

sraza-onshape commented 7 months ago

Hi @sraza-onshape Thank you for looking into this and providing your feedback. Issues 1 and 2 we will address in an upcoming documentation update.

For issue 3, I may need more information to debug it. Can you please share the SDK code you are using?

from azure.identity import DefaultAzureCredential
from azure.ai.ml import MLClient
from azure.ai.ml.entities import (
    MonitoringTarget,
    MonitorDefinition,
    MonitorSchedule,
    RecurrencePattern,
    RecurrenceTrigger,
    ServerlessSparkCompute,
)

# get a handle to the workspace
subscription_id, resource_group, workspace = ..., ..., ...
ml_client = MLClient(DefaultAzureCredential(), subscription_id, resource_group, workspace)

spark_compute = ServerlessSparkCompute(
    instance_type="standard_e4s_v3",
    runtime_version="3.2"
)

monitoring_target = MonitoringTarget(endpoint_deployment_id="azureml:<insert_deployment_name>:<insert_deployment_name>")

monitor_definition = MonitorDefinition(compute=spark_compute, monitoring_target=monitoring_target)

recurrence_trigger = RecurrenceTrigger(
    frequency="day",
    interval=1,
    schedule=RecurrencePattern(hours=3, minutes=15)
)

model_monitor = MonitorSchedule(name="model_monitoring_thing", 
                                trigger=recurrence_trigger, 
                                create_monitor=monitor_definition)

poller = ml_client.schedules.begin_create_or_update(model_monitor)
created_monitor = poller.result()
nemanjarajic commented 6 months ago

Hi @sraza-onshape ,the issue has been identified and the fix will be implemented in the next sdk release.