Create a manually triggered task

Updated at:
Copy as MD

You can create a manually triggered task in DataStudio and manage it in Operation Center. This topic describes how to create a manually triggered task and deploy it to the production environment.

Usage notes

  • If you do not need to deploy the task to the production environment to run on a compute engine, you can create an ad hoc query instead.

  • A manually triggered task can only be run manually and does not support automatic scheduling.

  • You can set the execution order for manually triggered tasks by connecting them with lines, but this does not create a scheduling dependency.

  • There are only minor differences between a manually triggered workflow and a scheduled workflow. To learn about the UI, see Features on the DataStudio page.

Go to the manually triggered workflow page

Go to the DataStudio > Manually Triggered Workflows page to create manually triggered tasks.

  1. Go to the DataStudio page.

    Log on to the DataWorks console. In the target region, click Data Development and O&M > Data Development in the left-side navigation pane. Select a workspace from the drop-down list and click Go to Data Development.

  2. On the Data Studio page, click Manually Triggered Workflows in the left-side navigation pane. If this menu item is not visible, see Adjust the displayed DataStudio modules to add it manually.

Create a manually triggered workflow

In DataWorks, you organize data development tasks within a workflow. A workflow acts as a container, providing a canvas where you can arrange nodes, tools, and management actions for a specific business purpose. The following steps describe how to create a workflow:

  1. Create a workflow by using one of the following methods:

    • Method 1: Hover over the 创建业务流程 icon and click Create Workflow.

    • Method 2: In the directory tree on the left side of DataStudio, right-click Manually Triggered Workflows and select Create Workflow.

  2. In the Create Workflow dialog box, enter a name and description for the workflow, and then click Create.

For more information about workflows, see Create and manage workflows.

Create a manually triggered node

You can create a node from the directory tree or the workflow canvas.

  1. Create a manually triggered node.

    • Method 1: Create from the directory tree.

      1. In the directory tree under Manually Triggered Workflows, find the workflow that you created in Create a manually triggered workflow.

      2. Right-click the required compute engine and select a node type under Create Node.

    • Method 2: Create from the workflow canvas.

      1. In the directory tree under Manually Triggered Workflows, find the workflow that you created in Create a manually triggered workflow.

      2. Double-click the workflow to open the workflow canvas.

      3. At the top of the canvas, click Create Node. Then, in the left-side navigation pane, click the required node type or drag it onto the canvas.

  2. Configure the node name, compute engine instance, and other information.

  3. Define the task code.

    Write the task logic using the syntax for the selected compute engine. To pass parameters dynamically, define variables in the ${Variable name} format. You can then assign default values to these variables in the node properties, similar to how variables are defined for scheduled tasks.

    Note

    The scheduling parameter configuration varies by node type. For example, variables in a Shell node must use the $1, $2, $3, ... format. For more information, see Configure scheduling parameters for different types of nodes.

(Optional) Set the execution order

Defining an execution order for nodes in a manually triggered workflow is optional. You can, however, connect nodes on the workflow canvas to set an upstream-to-downstream execution order. When you run the entire workflow, nodes without a defined order are triggered concurrently, while nodes with a defined order are triggered sequentially.

执行顺序

Configure node properties

If the task needs to access data from a compute engine in the production environment, you can configure its execution properties in the right-side panel of the node editor. These properties are the same as for a scheduled task. The following properties are available:

Property

Description

General

The node name, ID, type, and owner are automatically displayed. No configuration is required.

Note
  • By default, the owner is the current logged-in user. You can change the owner as needed. You can select only a member of the current workspace as the owner.

  • An ID is automatically generated after you commit the node.

Parameters

Defines parameters used when the node runs.

Note

DataWorks provides built-in and custom parameters for dynamically assigning values during task execution. If you have defined variables in your code, assign their values in this section.

Resource Group

Specifies the resource group used to run the task after it is deployed to the production environment. You can select a scheduling resource group that is available for the current workspace. We recommend purchasing and using a DataWorks serverless resource group. For more information, see Use a serverless resource group.

Debug manually triggered nodes

You can use the 调试按钮 and 调试 icons on the node editor toolbar to debug the current node. You can also click the 调试 Run icon on the workflow canvas to debug the entire manually triggered workflow.

Note

This operation runs under your account and uses the data source configured for the development environment. To view or manage data sources, go to the Workspace Settings > Data Source > Data Sources page. For more information, see Manage data sources.

(Optional) Define workflow parameters

If your manually triggered workflow contains variables that have the same name and you want to assign values to them in one place, you can define workflow parameters on the workflow canvas. After the parameters are defined, you can run the workflow, assign values to the parameters, and view the execution details of the manually triggered tasks with those values.

You can set default values for workflow parameters, or define only the parameter names and assign specific values each time you run the workflow in the production environment.

Commit and deploy a node

To run a manually triggered task in the production environment, you must save, commit, and deploy the node to Operation Center. For more information, see Deploy nodes. Confirm the final deployment status, as the deployment can fail.

After the task is deployed, go to Operation Center > Manually Triggered Task O&M to view the manually triggered node that you deployed.

Run a task in production

To run a manually triggered task, navigate to Operation Center > Manually Triggered Task O&M and open the Manually Triggered Tasks page. On this page, you can find and run a target task.

Note

A manually triggered task can run for a maximum of three days. If a task exceeds this limit, DataWorks automatically stops it, and the corresponding instance fails.

  • Assign workflow parameter values: If the manually triggered workflow has workflow parameters, you can assign values to them each time you run the workflow. This action assigns the same values to all variables with matching names in the code of the workflow's nodes. This option is available only for workflows with defined workflow parameters.

  • Task execution order: The execution order follows the logic described in the '(Optional) Set the execution order for manually triggered nodes' section:

    • When you run an entire workflow, tasks without a defined execution order are triggered concurrently.

    • Tasks with a defined execution order run sequentially.上下游

Running a manually triggered task in the production environment generates a manually triggered instance. You can view the execution results on the Manually Triggered Instances page, located at Manually Triggered Task O&M > Manual instance.