作为事件网格源的 Azure 机器学习Azure Machine Learning as an Event Grid source

本文提供了机器学习工作区事件的属性和架构。This article provides the properties and schema for machine learning workspace events. 有关事件架构的简介,请参阅 Azure 事件网格事件架构For an introduction to event schemas, see Azure Event Grid event schema.

可用事件类型Available event types

Azure 机器学习发出以下事件类型:Azure Machine Learning emits the following event types:

事件类型Event type 说明Description
Microsoft.MachineLearningServices.ModelRegisteredMicrosoft.MachineLearningServices.ModelRegistered 已成功注册新模型或模型版本时引发。Raised when a new Model or Model version has been successfully registered.
Microsoft.MachineLearningServices.ModelDeployedMicrosoft.MachineLearningServices.ModelDeployed 将模型成功部署到终结点时引发。Raised when Model(s) have been successfully deployed to an Endpoint.
Microsoft.MachineLearningServices.RunCompletedMicrosoft.MachineLearningServices.RunCompleted 在成功完成运行时引发。Raised when a Run has been successfully completed.
Microsoft.MachineLearningServices.DatasetDriftDetectedMicrosoft.MachineLearningServices.DatasetDriftDetected 当数据集偏移监视器检测到偏移时引发。Raised when a Dataset drift monitor detects drift.
Microsoft.MachineLearningServices.RunStatusChangedMicrosoft.MachineLearningServices.RunStatusChanged 当运行状态更改时引发。Raised when a run status changes.

示例事件Example events

触发某个事件后,事件网格服务会将有关该事件的数据发送到订阅终结点。When an event is triggered, the Event Grid service sends data about that event to subscribing endpoint. 本部分包含一个示例,介绍每个事件的数据外观。This section contains an example of what that data would look like for each event.

Microsoft.MachineLearningServices.ModelRegistered eventMicrosoft.MachineLearningServices.ModelRegistered event

[{
  "topic": "/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.MachineLearningServices/workspaces/{workspace-name}",
  "subject": "models/sklearn_regression_model:20",
  "eventType": "Microsoft.MachineLearningServices.ModelRegistered",
  "eventTime": "2017-06-26T18:41:00.9584103Z",
  "id": "831e1650-001e-001b-66ab-eeb76e069631",
  "data": {
    "ModelName": "sklearn_regression_model",
    "ModelVersion": 20,
    "ModelTags": {
        "area": "diabetes",
        "type": "regression"
    },
    "ModelProperties": {
        "type": "test"
    }
  },
  "dataVersion": "",
  "metadataVersion": "1"
}]

Microsoft.MachineLearningServices.ModelDeployed eventMicrosoft.MachineLearningServices.ModelDeployed event

[{
  "topic": "/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.MachineLearningServices/workspaces/{workspace-name}",
  "subject": "endpoints/my-sklearn-service",
  "eventType": "Microsoft.MachineLearningServices.ModelDeployed",
  "eventTime": "2017-06-26T18:41:00.9584103Z",
  "id": "831e1650-001e-001b-66ab-eeb76e069631",
  "data": {
    "ServiceName": "my-sklearn-service",
    "ServiceComputeType": "ACI",
    "ModelIds": "sklearn_regression_model:1,sklearn_regression_model:2",
    "ServiceTags": {
        "area": "diabetes",
        "type": "regression"
    },
    "ServiceProperties": {
        "type": "test"
    }
  },
  "dataVersion": "",
  "metadataVersion": "1"
}]

Microsoft.MachineLearningServices.RunCompleted eventMicrosoft.MachineLearningServices.RunCompleted event

[{
  "topic": "/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.MachineLearningServices/workspaces/{workspace-name}",
  "subject": "experiments/0fa9dfaa-cba3-4fa7-b590-23e48548f5c1/runs/AutoML_ad912b2d-6467-4f32-a616-dbe4af6dd8fc_5",
  "eventType": "Microsoft.MachineLearningServices.RunCompleted",
  "eventTime": "2017-06-26T18:41:00.9584103Z",
  "id": "831e1650-001e-001b-66ab-eeb76e069631",
  "data": {
    "experimentId": "0fa9dfaa-cba3-4fa7-b590-23e48548f5c1",
    "experimentName": "automl-local-regression",
    "runId": "AutoML_ad912b2d-6467-4f32-a616-dbe4af6dd8fc_5",
    "runType": null,
    "runTags": {},
    "runProperties": {
        "runTemplate": "automl_child",
        "pipeline_id": "5adc0a4fe02504a586f09a4fcbb241f9a4012062",
        "pipeline_spec": "{\"objects\": [{\"class_name\": \"StandardScaler\", \"module\": \"sklearn.preprocessing\", \"param_args\": [], \"param_kwargs\": {\"with_mean\": true, \"with_std\": false}, \"prepared_kwargs\": {}, \"spec_class\": \"preproc\"}, {\"class_name\": \"LassoLars\", \"module\": \"sklearn.linear_model\", \"param_args\": [], \"param_kwargs\": {\"alpha\": 0.001, \"normalize\": true}, \"prepared_kwargs\": {}, \"spec_class\": \"sklearn\"}], \"pipeline_id\": \"5adc0a4fe02504a586f09a4fcbb241f9a4012062\"}",
        "training_percent": "100",
        "predicted_cost": "0.062226144097381045",
        "iteration": "5",
        "run_template": "automl_child",
        "run_preprocessor": "StandardScalerWrapper",
        "run_algorithm": "LassoLars",
        "conda_env_data_location": "aml://artifact/ExperimentRun/dcid.AutoML_ad912b2d-6467-4f32-a616-dbe4af6dd8fc_5/outputs/conda_env_v_1_0_0.yml",
        "model_name": "AutoMLad912b2d65",
        "scoring_data_location": "aml://artifact/ExperimentRun/dcid.AutoML_ad912b2d-6467-4f32-a616-dbe4af6dd8fc_5/outputs/scoring_file_v_1_0_0.py",
        "model_data_location": "aml://artifact/ExperimentRun/dcid.AutoML_ad912b2d-6467-4f32-a616-dbe4af6dd8fc_5/outputs/model.pkl"
    }
  },
  "dataVersion": "",
  "metadataVersion": "1"
}]

Microsoft.MachineLearningServices.DatasetDriftDetected eventMicrosoft.MachineLearningServices.DatasetDriftDetected event

[{
  "topic": "/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.MachineLearningServices/workspaces/{workspace-name}",
  "subject": "datadrifts/{}/runs/{}",
  "eventType": "Microsoft.MachineLearningServices.DatasetDriftDetected",
  "eventTime": "2017-06-26T18:41:00.9584103Z",
  "id": "831e1650-001e-001b-66ab-eeb76e069631",
  "data": {
    "DataDriftId": "01d29aa4-e6a4-470a-9ef3-66660d21f8ef",
    "DataDriftName": "myDriftMonitor",
    "RunId": "01d29aa4-e6a4-470a-9ef3-66660d21f8ef_1571590300380",
    "BaseDatasetId": "3c56d136-0f64-4657-a0e8-5162089a88a3",
    "TargetDatasetId": "d7e74d2e-c972-4266-b5fb-6c9c182d2a74",
    "DriftCoefficient": 0.83503490684792081,
    "StartTime": "2019-07-04T00:00:00+00:00",
    "EndTime": "2019-07-05T00:00:00+00:00"
  },
  "dataVersion": "",
  "metadataVersion": "1"
}]

Microsoft.MachineLearningServices.RunStatusChanged 事件Microsoft.MachineLearningServices.RunStatusChanged event

[{
  "topic": "/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.MachineLearningServices/workspaces/{workspace-name}",
  "subject": "experiments/0fa9dfaa-cba3-4fa7-b590-23e48548f5c1/runs/AutoML_ad912b2d-6467-4f32-a616-dbe4af6dd8fc_5",
  "eventType": "Microsoft.MachineLearningServices.RunStatusChanged",
  "eventTime": "2017-06-26T18:41:00.9584103Z",
  "id": "831e1650-001e-001b-66ab-eeb76e069631",
  "data": {
    "experimentId": "0fa9dfaa-cba3-4fa7-b590-23e48548f5c1",
    "experimentName": "automl-local-regression",
    "runId": "AutoML_ad912b2d-6467-4f32-a616-dbe4af6dd8fc_5",
    "runType": null,
    "runTags": {},
    "runProperties": {
        "runTemplate": "automl_child",
        "pipeline_id": "5adc0a4fe02504a586f09a4fcbb241f9a4012062",
        "pipeline_spec": "{\"objects\": [{\"class_name\": \"StandardScaler\", \"module\": \"sklearn.preprocessing\", \"param_args\": [], \"param_kwargs\": {\"with_mean\": true, \"with_std\": false}, \"prepared_kwargs\": {}, \"spec_class\": \"preproc\"}, {\"class_name\": \"LassoLars\", \"module\": \"sklearn.linear_model\", \"param_args\": [], \"param_kwargs\": {\"alpha\": 0.001, \"normalize\": true}, \"prepared_kwargs\": {}, \"spec_class\": \"sklearn\"}], \"pipeline_id\": \"5adc0a4fe02504a586f09a4fcbb241f9a4012062\"}",
        "training_percent": "100",
        "predicted_cost": "0.062226144097381045",
        "iteration": "5",
        "run_template": "automl_child",
        "run_preprocessor": "StandardScalerWrapper",
        "run_algorithm": "LassoLars",
        "conda_env_data_location": "aml://artifact/ExperimentRun/dcid.AutoML_ad912b2d-6467-4f32-a616-dbe4af6dd8fc_5/outputs/conda_env_v_1_0_0.yml",
        "model_name": "AutoMLad912b2d65",
        "scoring_data_location": "aml://artifact/ExperimentRun/dcid.AutoML_ad912b2d-6467-4f32-a616-dbe4af6dd8fc_5/outputs/scoring_file_v_1_0_0.py",
        "model_data_location": "aml://artifact/ExperimentRun/dcid.AutoML_ad912b2d-6467-4f32-a616-dbe4af6dd8fc_5/outputs/model.pkl"
    },
   "runStatus": "failed"
   },
  "dataVersion": "",
  "metadataVersion": "1"
}]

事件属性Event properties

事件具有以下顶级数据:An event has the following top-level data:

属性Property 类型Type 说明Description
topic stringstring 事件源的完整资源路径。Full resource path to the event source. 此字段不可写入。This field isn't writeable. 事件网格提供此值。Event Grid provides this value.
subject stringstring 事件主题的发布者定义路径。Publisher-defined path to the event subject.
eventType stringstring 此事件源的一个注册事件类型。One of the registered event types for this event source.
eventTime stringstring 基于提供程序 UTC 时间的事件生成时间。The time the event is generated based on the provider's UTC time.
id 字符串string 事件的唯一标识符。Unique identifier for the event.
data 对象 (object)object Blob 存储事件数据。Blob storage event data.
dataVersion stringstring 数据对象的架构版本。The schema version of the data object. 发布者定义架构版本。The publisher defines the schema version.
metadataVersion stringstring 事件元数据的架构版本。The schema version of the event metadata. 事件网格定义顶级属性的架构。Event Grid defines the schema of the top-level properties. 事件网格提供此值。Event Grid provides this value.

对于每个事件类型,数据对象具有以下属性:The data object has the following properties for each event type:

Microsoft.MachineLearningServices.ModelRegisteredMicrosoft.MachineLearningServices.ModelRegistered

属性Property 类型Type 说明Description
ModelName stringstring 已注册模型的名称。The name of the model that was registered.
ModelVersion stringstring 已注册模型的版本。The version of the model that was registered.
ModelTags objectobject 已注册模型的标记。The tags of the model that was registered.
ModelProperties objectobject 已注册模型的属性。The properties of the model that was registered.

Microsoft.MachineLearningServices.ModelDeployedMicrosoft.MachineLearningServices.ModelDeployed

属性Property 类型Type 说明Description
ServiceName stringstring 已部署服务的名称。The name of the deployed service.
ServiceComputeType 字符串string 已部署服务的计算类型(例如 ACI、AKS)。The compute type (for example, ACI, AKS) of the deployed service.
ModelIds 字符串string 模型 ID 的逗号分隔列表。A comma-separated list of model IDs. 服务中部署的模型的 ID。The IDs of the models deployed in the service.
ServiceTags objectobject 已部署服务的标记。The tags of the deployed service.
ServiceProperties objectobject 已部署服务的属性。The properties of the deployed service.

Microsoft.MachineLearningServices.RunCompletedMicrosoft.MachineLearningServices.RunCompleted

属性Property 类型Type 说明Description
experimentId stringstring 此运行所属的试验的 ID。The ID of the experiment that the run belongs to.
experimentName stringstring 此运行所属的试验的名称。The name of the experiment that the run belongs to.
runId stringstring 已完成的运行的 ID。The ID of the Run that was completed.
runType stringstring 已完成的运行的运行类型。The Run Type of the completed Run.
runTags objectobject 已完成的运行的标记。The tags of the completed Run.
runProperties objectobject 已完成的运行的属性。The properties of the completed Run.

Microsoft.MachineLearningServices.DatasetDriftDetectedMicrosoft.MachineLearningServices.DatasetDriftDetected

属性Property 类型Type 说明Description
DataDriftId stringstring 触发了事件的数据偏移监视器的 ID。The ID of the data drift monitor that triggered the event.
DataDriftName stringstring 触发了事件的数据偏移监视器的名称。The name of the data drift monitor that triggered the event.
RunId stringstring 检测到数据偏移的运行的 ID。The ID of the Run that detected data drift.
BaseDatasetId stringstring 用于检测偏移的基础数据集的 ID。The ID of the base Dataset used to detect drift.
TargetDatasetId stringstring 用于检测偏移的目标数据集的 ID。The ID of the target Dataset used to detect drift.
DriftCoefficient Doubledouble 触发了事件的系数结果。The coefficient result that triggered the event.
StartTime datetimedatetime 导致了偏移检测的目标数据集时序的开始时间。The start time of the target dataset time series that resulted in drift detection.
EndTime datetimedatetime 导致了偏移检测的目标数据集时序的结束时间。The end time of the target dataset time series that resulted in drift detection.

Microsoft.MachineLearningServices.RunStatusChangedMicrosoft.MachineLearningServices.RunStatusChanged

属性Property 类型Type 说明Description
experimentId stringstring 此运行所属的试验的 ID。The ID of the experiment that the run belongs to.
experimentName stringstring 此运行所属的试验的名称。The name of the experiment that the run belongs to.
runId stringstring 已完成的运行的 ID。The ID of the Run that was completed.
runType stringstring 已完成的运行的运行类型。The Run Type of the completed Run.
runTags objectobject 已完成的运行的标记。The tags of the completed Run.
runProperties objectobject 已完成的运行的属性。The properties of the completed Run.
runStatus stringstring 运行的状态。The status of the Run.

教程和操作指南Tutorials and how-tos

标题Title 说明Description
使用 Azure 机器学习事件Consume Azure Machine Learning events 概述 Azure 机器学习与事件网格的集成。Overview of integrating Azure Machine Learning with Event Grid.

后续步骤Next steps