Platform for AI (PAI) provides a notification mechanism for workspaces. You can create notification rules of events to track and monitor the status of Deep Learning Containers (DLC) jobs or Machine Learning Designer pipeline jobs. You can also use notification rules to trigger events when the model version status changes. This topic describes how to manage workspace events.
Limits
The following types of event targets are only supported in the China (Ulanqab) region: voice calls, text messages, and emails.
Terms
Before you create a notification rule, we recommend that you get familiar with the following terms:
Notification rule: a rule that specifies how notifications are triggered and sent. The rule specifies properties such as notification events and recipients.
Event: a data record of status changes. State changes include whether a job fails or ends.
Event Type: the producer of an event. In PAI, producers are modules such as Machine Learning Designer, DLC, or models. The events may be job failure, job success, or model version status changes from the producers.
Event scope: the scope within which an event is sent. An event scope is determined based on user roles and permissions. For example, a job state notification is sent to you only if the job is created by you.
Event target: the consumer of an event.
Create an event rule
You can set event rules to monitor specific types of events. When an event that matches an event rule occurs, the event is routed to the target associated with the event rule.
Go to the Workspace Details page.
Log on to the PAI console.
In the left-side navigation pane, click Workspaces. On the Workspaces page, click the name of the workspace that you want to manage.
Grant permissions that are required to create a notification rule.
The first time you create a notification rule, you must activate EventBridge and attach the AliyunServiceRoleForPAIWorkspace role to PAI. Perform the following steps:
Activate EventBridge. For more information, see Activate EventBridge and grant permissions to a RAM user.
NoteTo facilitate account management, PAI automatically creates a custom event bus for each workspace. The event buses are named in the pai-system-${Workspace name} format. You can log on to the EventBridge console, switch to the region where the workspace resides and manage the custom event bus.
On the Workspace Details page, click the Events tab.
Click Authorize Now. In the Authorization dialog box, click Authorize.
The system automatically creates the service-linked role AliyunServiceRoleForPAIWorkspace. For more information about the role, see Appendix: Service-linked role AliyunServiceRoleForPAIWorkspace.
Grant the required permissions to the Resource Access Management (RAM) user that you use.
Use the following script to create a policy and attach the policy to the RAM user. For more information about how to create a policy, see Create a custom policy on the JSON tab. For more information about how to grant permissions to a RAM user, see Grant permissions to a RAM user.
{ "Statement": [{ "Effect": "Allow", "Action": [ "eventbridge:CreateEventBus", "eventbridge:GetEventBus", "eventbridge:DeleteEventBus", "eventbridge:ListEventBuses", "eventbridge:CreateRule", "eventbridge:GetRule", "eventbridge:UpdateRule", "eventbridge:EnableRule", "eventbridge:DisableRule", "eventbridge:DeleteRule", "eventbridge:ListRules", "eventbridge:PutEvents", "eventbridge:UpdateTargets", "eventbridge:DeleteTargets", "eventbridge:ListTargets" ], "Resource": "acs:eventbridge:*:*:eventbus/*" }], "Version": "1" }
Create a notification rule.
On the Events tab, click Create Event Rule.
On the Create Event Rule panel, configure the parameters and click Submit. The following table describes the parameters.
Parameter
Description
Rule name
Follow the on-screen instructions to specify a rule name.
Event Type
Values in the Event Source drop-down list:
Pipeline Jobs: a Machine Learning Designer pipeline.
DLC Jobs: a DLC job.
Models: a model that is registered in AI Computing Asset Management.
The values in the Event Type drop-down list vary based on the Event Source parameter.
Pipeline Jobs
Job Failure: The system sends an event notification if a task fails.
Job Complete (Succeeded or Failed): The system sends an event notification if a job fails or is successful.
DLC Jobs
Job Failure: The system sends an event notification if a task fails.
Job Complete (Succeeded or Failed): The system sends an event notification if a job fails or is successful.
Automatic Fault Tolerance: The system sends an event notification if an error occurs in a DLC job and automatic fault tolerance is triggered.
Models
Version Approved: When the model approval status changes from Pending to Approved, the system sends an event notification or calls a specified operation.
Version Status Changed (Approved or Rejected): When the model approval status changes, the system sends an event notification or calls a specified operation.
Event Scope
Valid values:
Created by Me
In the current workspace
Specified Pipeline
NoteThe option is available only when you set the Event Source parameter to Pipeline Jobs. You must also specify the Specified Pipeline parameter to an existing pipeline in Machine Learning Designer.
Specify Model
NoteThe option is available only when you set the Event Source parameter to Models. You must also specify the Specify Model parameter to a registered model. To view all registered models, choose Register and manage models.
. For more information, see
Event Target
DingTalk Notification
To use a DingTalk Chatbot, you need to configure the Webhook and Add Signature parameters. For more information, see the Appendix: Obtain a webhook URL and a key section of this topic. You can click Test Connectivity to check whether the configured content is valid.
HTTP/HTTPS
The option is available only when you set the Event Source parameter to Models. Set the URL parameter to the specified HTTP or HTTPS operations. The system calls specified HTTP or HTTPS operations when the model version status changes. Note that the specified operations need to be parsed based on the specification template.
Voice Calls
The option is available only if you set the Event Source parameter to Pipeline Jobs or DLC Jobs. You need to configure a contact. If no contacts are available, you can click Create to create contacts.
Text Message
The configuration method is the same as that for Voice Calls.
Email
The configuration method is the same as that for Voice Calls.
NoteBy default, a rule supports 5 event targets. Go to Quota Center to apply for higher quota. We recommend that you apply for less than 100 event targets. When adding contact for Voice Calls, Text Message, and Email, the same person may occupy multiple quotas. For example, If you add Alice and Tony for Text Message and add Alice and Alan for Email, altogether 4 quotas are occupied.
Appendix: Obtain a webhook URL and a key
Find the DingTalk group where you want to receive the event notification and follow the instructions shown in the following figure to add a DingTalk chatbot.
Follow the instructions shown in the following figure to open the Add Robot dialog box.
In the Add Robot dialog box, configure the parameters shown in the following figure, copy the key, and then click Finished.
ImportantSave the copied key to your computer for later use.
In the Add Robot dialog box, click Copy and Finished.
ImportantSave the webhook URL to your computer for later use.
The key and webhook URL that you obtained in Steps 3 and 4 are the values for the Additional Signature and Webhook parameters.