Trigger Node Development Instructions
If your data system spans multiple platforms with cross-platform task dependencies, you can use trigger nodes to manage them. For example, if an algorithm is developed in System A, a recurring task in Dataphin can be configured to run only after that algorithm produces its output.
Prerequisites
To use external trigger nodes, ensure the following conditions are met:
-
You have purchased the Dataphin OpenAPI feature.
-
The environment that sends the trigger request must have network connectivity to Dataphin.
Basic characteristics of trigger nodes
Trigger nodes differ from other compute nodes in the following ways:
-
A recurring instance of a trigger node starts to run when the following conditions are met:
-
The current system time is later than or equal to the scheduled runtime of the instance. This is the same as other compute nodes.
-
As with other compute tasks, the runtime status of all ancestor nodes is Succeeded.
-
An external trigger request has been received. This condition is unique to trigger nodes.
-
-
Data backfill instances for trigger nodes do not depend on external trigger requests. This is the same as for other compute nodes.
Trigger Methods
Dataphin supports external triggers only through the OpenAPI. An external system sends a trigger request via the OpenAPI to start a trigger node.
External trigger
To use an external trigger, complete the following steps:
-
Obtain the trigger information.
Before sending an external trigger request, obtain the following information:
-
Node ID (node_id): Find the node ID in the Basic Information section of the Properties panel for the submitted trigger node.
-
Project ID (project_id): Find the project ID in the URL of your browser on the Develop page. For example, if the URL is
https://www.aliyun.com/dev/codeManage/698348****632?env=DEV&projectId=6982117****30048&tenantId=309107012, the project ID is6982117****30048. -
Tenant ID (tenant_id): Find the tenant ID in the URL of your browser on the Develop page. For example, if the URL is
https://www.aliyun.com/dev/codeManage/698348****632?env=DEV&projectId=6982117****30048&tenantId=309***012, the tenant ID is309***012.
-
-
Write the trigger node code.
The following example uses Java.
ImportantObtain the required JAR packages from the Alibaba Cloud helpdesk. For more information, see Online Customer Service.
DefaultProfile profile = DefaultProfile.getProfile("<Your region>", "<Dataphin accessKey>", "<Dataphin secret>"); DefaultProfile.addEndpoint("<Your region>", "dataphin-public", "<Your openapi endpoint>"); profile.getHttpClientConfig().setIgnoreSSLCerts(true); DefaultAcsClient client = new DefaultAcsClient(profile); ExecuteTriggerNodeRequest request = new ExecuteTriggerNodeRequest(); // Set the ID of the tenant where the node to be triggered is located. request.setOpTenantId(0L); // Set the data timestamp for the recurring instance to be triggered. The format is yyyy-MM-dd. request.setBizDate("<bizdate>"); // Set the ID of the node to be triggered. request.setNodeId("<node_id>"); // Set the ID of the project where the node to be triggered is located. request.setProjectId(0L); // Set the environment type. request.setEnv("PROD"); ExecuteTriggerNodeResponse response = client.getAcsResponse(request); System.out.println(response.getCode()); -
After the code runs successfully and Dataphin receives the trigger request, the trigger node status changes to Succeeded.