Input and output parameters are used to transmit data between ancestor and descendant nodes. This topic describes how to define and use input and output parameters.

Background information

After you define an output parameter and its value for a node, you can define an input parameter for the descendant node of the node and configure the descendant node to reference the value of the output parameter in the input parameter.

Precautions

Input and output parameters are used together with assignment nodes. Some types of nodes support the assignment parameter. The assignment parameter functions the same as an assignment node. For more information about how to configure the assignment parameter, see the Assignment parameter section in this topic and the topic about how to configure an assignment node.

Configure input and output parameters

  1. Log on to the DataWorks console.
  2. In the left-side navigation pane, click Workspaces.
  3. In the top navigation bar, select the region in which the workspace that you want to manage resides. Find the workspace and click Data Development in the Actions column.
  4. In the Scheduled Workflow pane of the DataStudio page, double-click a desired node to go to the configuration tab of the node.
  5. Click the Properties tab in the right-side navigation pane. On the Properties tab, configure the input and output parameters in the Input and Output Parameters section.
    For more information about how to configure scheduling parameters for different types of nodes, see SQL nodes and batch synchronization nodes. Input and Output Parameters section

Output parameters

You can define output parameters in the Input and Output Parameters section. The following value types are supported for output parameters: Constant and Variable.

After you define an output parameter for the current node and commit the current node, the output parameter can be referenced as an input parameter for a descendant node of the current node.
Note You cannot write code for the current node to assign a value to the defined output parameter.
Output Parameters
Field Description Remarks
No. The serial number, which is automatically increased by 1 each time you define an output parameter. N/A
Parameter Name The name of the output parameter. N/A
Type The value type of the output parameter. Valid values: Constant and Variable.
Value The value of the output parameter. The value type can be Constant or Variable.
  • If the Type field is set to Constant, the value is a fixed string.
  • If the Type field is set to Variable, the value can be a global variable, a built-in scheduling parameter, or a custom scheduling parameter in the ${...} or $[…] format.
Description The description of the output parameter. N/A
Add Method The way in which the output parameter is defined. Valid values: Added Automatically, Auto Parse, and Added Manually.
Actions You can click Change or Delete to perform the related operation. These two operations are not supported if a node depends on the current node. Before you configure a node to reference the output parameter of the current node, make sure that the output parameter is correctly defined on the current node.

Assignment parameter

If the current node supports the assignment parameter and you want to pass the query results of the current node to its descendant node as a parameter, you can perform the following operations: Go to the configuration tab of the current node. Click the Properties tab in the right-side navigation pane. In the Output Parameters table in the Input and Output Parameters section, click Add assignment parameter. The outputs assignment parameter is added. The following types of nodes support the assignment parameter: EMR Hive, EMR Spark SQL, ODPS Script, Hologres SQL, AnalyticDB for PostgreSQL, and MySQL.
Note The assignment parameter is supported only in DataWorks Standard Edition or a more advanced edition.
After you click Add assignment parameter to add the outputs assignment parameter, a descendant node of the current node can reference the outputs parameter to obtain the query results of the current node. If the query results of the current node are empty, the current node is not blocked. However, the descendant node that references the outputs assignment parameter of the current node may fail to run. Add assignment parameter

You must add the assignment parameter of the current node as an input parameter of a descendant node of the current node. The assignment parameter can be referenced by using a two-dimensional array in the code. The assignment parameter functions the same as an assignment node in the ODPS SQL language.

Input parameters

An input parameter of a node defines the reference to the output of an ancestor node of the node. The input parameter can be used in the same way as other parameters.

The following descriptions show how to define and use an input parameter:
  • Define an input parameter
    1. In the Dependencies section of the Properties tab on the configuration tab of a desired node, add a node on which the current node depends. Add a dependency
    2. In the Input Parameters table in the Input and Output Parameters section, define an input parameter and configure this parameter to reference the output parameter of an ancestor node of the current node. Input Parameters
      Field Description Remarks
      No. The serial number, which is automatically increased by 1 each time you define an input parameter. N/A
      Parameter Name The name of the input parameter. N/A
      Value Source The value source of the input parameter. The value of the input parameter is the value of the output parameter of the ancestor node.
      Description The description of the input parameter. N/A
      Parent Node ID The ID of the ancestor node. The system parses the ID of the ancestor node.
      Add Method The way in which the input parameter is defined. Valid values: Added Automatically, Auto Parse, and Added Manually.
      Actions You can click Change or Delete to perform the related operation. N/A
  • Use the input parameter
    The defined input parameter is referenced in the code of a node in the same way as other built-in scheduling parameters. The input parameter is configured in the ${Input parameter name} format. The following figure shows how to reference an input parameter in the code of a Shell node. Reference

Supported built-in scheduling parameters

  • Built-in scheduling parameters
    Built-in scheduling parameter Description
    ${projectId} The ID of the MaxCompute project.
    ${projectName} The name of the MaxCompute project.
    ${nodeId} The ID of the node.
    ${gmtdate} The date on which the node instance is scheduled to run, in the yyyy-MM-dd 00:00:00 format.
    ${taskId} The ID of the node instance.
    ${seq} The sequence number of the node instance, which indicates the ranking of this node instance among all node instances on the same day.
    ${cyctime} The time at which the node instance is scheduled to run.
    ${status} The status of the node instance. Valid values: SUCCESS and FAILURE.
    ${bizdate} The data timestamp.
    ${finishTime} The time at which the node instance finishes running.
    ${taskType} The mode in which the node instance is run. Valid values: NORMAL, MANUAL, PAUSE, SKIP, UNCHOOSE, and SKIP_CYCLE.
    ${nodeName} The name of the node.
  • For more information about other parameters, see Overview of scheduling parameters.