EMR Serverless Spark integrates with CloudMonitor to send alert notifications when jobs fail, time out, or change state. For example, you can receive an email when a workflow node fails, or route failure events to Function Compute to trigger automated remediation.
Alert delivery methods
CloudMonitor is a monitoring service for Alibaba Cloud resources. It provides a unified entry for querying system events across all Alibaba Cloud services. For more information, see What is CloudMonitor.
CloudMonitor supports two alert delivery methods:
Send alerts by text message, email, or DingTalk robot.
Route events to Message Queue, Simple Log Service, Function Compute, or Webhook. Use this option to automate handling of anomalous activity.
Prerequisites
Before you begin, ensure that you have:
A running workflow. For more information, see Manage workflows
Supported event types
EMR Serverless Spark emits three types of system events:
| Event type | When it fires | Monitoring granularity |
|---|---|---|
| EMRSpark:JobRun:FAILED | Once, when a job run fails. Covers batch jobs and streaming jobs submitted through Data Studio, sessions and batches launched through Livy Gateway or Kyuubi Gateway, and SQL, Notebook, and Spark Thrift Server sessions. | Task level |
| EMRSpark:JobRun:TIMEOUT | Once, when a task does not complete within the configured time limit. | Task level |
| EMRSpark:Workflow:TaskStateChange | Every time a workflow node transitions to a new state — including RUNNING, SUCCESS, and FAILED. | Workflow node level |
ForEMRSpark:Workflow:TaskStateChange, subscribe to specific states using the Event Content filter (for example,toState: FAILED) to avoid receiving a notification for every state transition.
To see all available EMRSpark events, open the CloudMonitor console and search for EMRSpark.
Usage notes
Before configuring a subscription, note the following:
Workflow state change events may be delayed. After a workflow node changes state, the corresponding event can take several minutes to appear in CloudMonitor.
`EMRSpark:Workflow:TaskStateChange` fires on every state transition. Without a state filter, you receive a notification for each transition (RUNNING, SUCCESS, FAILED, and so on). Filter by
toState: FAILEDto receive only failure alerts.Configure RUNNING notifications separately. Set up a separate subscription for job running events to avoid duplicate notifications alongside your success and failure alerts.
Create a subscription policy
This section walks through creating a subscription policy for EMRSpark:Workflow:TaskStateChange filtered to FAILED states, so you get notified only when a workflow node fails.
Step 1: Get the event resource ID
Log on to the CloudMonitor console.
In the left navigation pane, choose Event Center > System Event.
On the Event Monitoring tab, set Product to E-MapReduce and Event Name to EMRSpark:Workflow:TaskStateChange, then click Search.
Find the resource ID of the target event in the filtered results. The resource ID follows this format:
acs:emr:cn-hangzhou:<Alibaba Cloud account ID>:resourceId/workspaceId/<workspaceId>#workflowDefinitionName/<workflowDefinitionName>#taskDefinitionName/<taskDefinitionName>You can also construct the resource ID manually using this format if you know the workspace ID, workflow name, and task name.

Step 2: Create the subscription policy
In the left navigation pane, choose Event Center > Event Subscription. Alternatively, choose Event Center > System Event, then click Create Now in the Welcome To The New Event Center section.
On the Subscription Policy tab, click Create Subscription Policy.
On the Create Subscription Policy page, configure the following parameters:
Name: Enter a name for the subscription policy.
Subscription Type: Select System events.
Subscription Scope:
Product: Select E-MapReduce.
Event Name: Select EMRSpark:Workflow:TaskStateChange.
Event Content: Enter
toState: FAILED. This filters the subscription to fire only when a node transitions to the FAILED state.The supported node states are:
Event Resources: Enter the resource ID from Step 1.
Event Type, Event Level, and Application grouping: Leave these fields blank.
Combined noise reduction: Use the default settings.
Notification: Create or select a notification configuration. To create one, enter a name, set Notification settings to Set the notification group directly, select an Alert contact group, then click OK. CloudMonitor sends alerts through the notification methods configured for each contact in the group (for example, phone call, text message, and email). For more information, see Create a notification configuration policy.
Push and Integration: Skip this section. For details on setting up a push channel, see Create a push channel.
Click Submit.
Verify the subscription
After creating the subscription policy, use the debug feature to confirm that alerts fire correctly.
On the Subscription Policy tab, click Debug event subscription.
In the Create event debugging panel, set Product to E-MapReduce and Name to EMRSpark:Workflow:TaskStateChange. The system generates debug content in JSON format automatically.
Click OK. The Operation successful message appears. CloudMonitor sends a test alert to the contacts in the subscription policy using the configured notification methods.