All Products
Search
Document Center

Platform For AI:Workspace notification

Last Updated:Feb 01, 2024

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.

  1. Go to the Workspace Details page.

    1. Log on to the PAI console.

    2. In the left-side navigation pane, click Workspaces. On the Workspace list page, click the name of the workspace that you want to manage.

  2. 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:

    1. Activate EventBridge. For more information, see Activate EventBridge and grant permissions to a RAM user.

      Note

      To 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.

    2. On the Workspace Details page, click the Events tab.

    3. 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.

    4. 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"
      }
  3. Create a notification rule.

    1. On the Events tab, click Create Event Rule.

    2. 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: 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

        Note

        The 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

        Note

        The 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 AI Computing Asset Management > Models. For more information, see Register and manage models.

      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.

      Note

      You can select Voice Calls, Text message, and Email only in the China (Ulanqab) region.

Appendix: Obtain a webhook URL and a key

  1. 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.

    机器人

  2. Follow the instructions shown in the following figure to open the Add Robot dialog box.

    添加机器人

  3. In the Add Robot dialog box, configure the parameters shown in the following figure, copy the key, and then click Finished.

    Important

    Save the copied key to your computer for later use.

    添加机器人

  4. In the Add Robot dialog box, click Copy and Finished.

    Important

    Save 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.