Path8.Mod1.b - Intro to DevOps Principles for ML - Trigger with Azure ML Events Flashcards
Augmented learning: https://learn.microsoft.com/en-us/azure/machine-learning/how-to-use-event-grid?view=azureml-api-2
The Microsoft.MachineLearningServices.<Event Types>
for Azure Machine Learning in EventGrid that’s raised when an ML Experiment completes
RunCompleted
The Microsoft.MachineLearningServices.<Event Types>
for Azure Machine Learning in EventGrid that’s raised when an ML Model is registered to a workspace
ModelRegistered
The Microsoft.MachineLearningServices.<Event Types>
for Azure Machine Learning in EventGrid that’s raised when an Inference Service Deployment is completed
ModelDeployed
The Microsoft.MachineLearningServices.<Event Types>
for Azure Machine Learning in EventGrid that’s raised when a data drift detection job for two datasets is completed
DatasetDriftDetected
The Microsoft.MachineLearningServices.<Event Types>
for Azure Machine Learning in EventGrid that’s raised when a run status changed
RunStatusChanged
Permissions necessary to use Event Grid and to subcribe to ML Events with your Azure ML Workspace
Like most anything, you need Contributor or Owner
Tools used for subscribing to ML Events
Azure Portal, Powershell or Azure CLI
TEWs ET PO Ig FC
Five Best Practices for consuming ML Events
- Check the Topic of the Message to ensure it’s coming from the expected Workspace
- Check the EventType to ensure it’s one you can process
- Check etag and sequencer fields to ensure processing order (messages can arrive out of order)
- Ignore fields you don’t understand (new features will break you otherwise)
- Failed or cancelled ML operations will not trigger an Event; consider this when developing your event handlers
F LA EH DFP GW (AZ-900)
Options for Event Handler implementation
- Azure Functions
- Azure Logic Apps
- Azure Event Hubs
- Azure Data Factory Pipeline
- Generic webhooks
CLI code for subscribing to an ML Event
- What --endpoint
and --endpoint-type
represent
- Two datapoints the --source-resource-id
needs
- The one datapoint the --endpoint
needs
-
--endpoint
and--endpoint-type
indicate the Event Handling mechanism - The EventGrid subscription needs
– name
– source (source-resource-id)
– endpoint type
– endpoint
– included-event-types: the events you want to subscribe the handler to
– Has optional filter by subject start string -
--source-resource-id
needs subscription ID and Workspace name -
--endpoint
needs subscription ID
// Select the Azure subscription that contains the workspace az account set --subscription "<name or ID of the subscription>" // Subscribe to the machine learning workspace. This uses EventHub az eventgrid event-subscription create --name {eventGridFilterName} --source-resource-id /subscriptions/{subId}/resourceGroups/{RG}/providers/Microsoft.MachineLearningServices/workspaces/{wsName} --endpoint-type eventhub --endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/n1/eventhubs/EH1 --included-event-types Microsoft.MachineLearningServices.ModelRegistered --subject-begins-with "models/mymodelname"