Context-based parameters are used to transmit data between parent and child nodes. This topic describes how to define and use context-based input and output parameters.

After you define an output parameter and its value for a parent node, you can configure a child node to reference this value in an input parameter.
Notice You cannot use context-based parameters for AnalyticDB for MySQL nodes.

Double-click a node to open it. Click the Properties tab in the right-side navigation pane. Then, configure the parameters in the Parameters section.

Output parameters

You can configure output parameters in the Parameters section. The following two types of output parameter values are supported: Constant and Variable.

After you define an output parameter and commit the current node, the output parameter value can be referenced in the code of the child node as the input parameter value.
Note You cannot write code for the current node to assign a value to the defined output parameter.
Field Description Remarks
No. The system automatically increases the ID. N/A
Parameter Name The name of the output parameter. N/A
Type The type of the output parameter. Valid values: Constant and Variable.
Value The value of the output parameter. The value can be a 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, you can use global variables, built-in scheduling variables, and custom variables in the format of ${...} or $[…].
Description The brief description of the output parameter. N/A
Add Method The way in which the output parameter is added. Valid values: Added Automatically, Auto Parse, and Added Manually.
Actions Valid values: Save and Cancel. The save and cancel operations are not supported if a child node depends on the current node. Before you configure the child node to reference the output parameter value of the current node, make sure that the output parameter is defined correctly on the current node.

Assignment parameter

The query results of a node can be referenced as input parameter values by a child node of the node. To pass data from a supported type of node, click the Properties tab in the right-side navigation pane of the configuration tab. In the Parameters > Output Parameters section, click Add assignment parameter to create an assignment parameter as an output parameter with a few clicks. Supported nodes include EMR HIVE nodes, EMR SPARK nodes, ODPS Script nodes, Hologres SQL nodes, and AnalyticDB for PostgreSQL nodes.
Note You can use assignment parameters only in DataWorks Standard Edition or a more advanced edition.
After you click Add assignment parameter, the created assignment parameter is assigned the query results of the current node. If the query results are empty, the current node is not blocked. However, its child nodes may fail to run.Add assignment parameter

You must add the assignment parameter of the current node as an input parameter of the child node. The assignment parameter can be referenced by using a two-dimensional array in the code. A node that is configured with an assignment parameter is used in the same way as an assignment node that uses MaxCompute SQL.

Input parameters

An input parameter of a node defines the reference to the output of the parent node on which the node depends. The input parameter can be used inside the node in the same way as other parameters.

The following section describes how to define and use an input parameter:
  • Define an input parameter
    1. In the Dependencies section, add a parent node on which the current node depends.Add the dependencies
    2. In the Parameters section, create an input parameter and configure this parameter to reference the output parameter value of the parent node.
      Field Description Remarks
      No. The system automatically increases the ID. N/A
      Parameter Name The name of the input parameter. N/A
      Value Source The value source of the input parameter. The input parameter references the value of the output parameter of the parent node.
      Description The brief description of the input parameter. N/A
      Parent Node ID The ID of the parent node. The system automatically parses the ID of the parent node.
      Add Method The way in which the input parameter is added. Valid values: Added Automatically, Auto Parse, and Added Manually.
      Actions Valid values: Save and Cancel. N/A
  • Use the input parameter
    The defined input parameter is referenced in the code of a node in the same way as other system variables. The parameter value is referenced in the ${input parameter name} format. The following figure shows how to reference an input parameter in the code of a Shell node.Reference

Global variables supported by the system

  • System variables
    System variable Description
    ${projectId} The ID of the project.
    ${projectName} The name of the MaxCompute project.
    ${nodeId} The ID of the node.
    ${gmtdate} The date on which the node instance is 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 instance among all node instances on the same day.
    ${cyctime} The scheduled runtime of the node instance.
    ${status} The status of the node instance. Valid values: SUCCESS and FAILURE.
    ${bizdate} The data timestamp.
    ${finishTime} The time when the node instance stops running.
    ${taskType} The running type of the node instance. Valid values: NORMAL, MANUAL, PAUSE, SKIP, UNCHOOSE, and SKIP_CYCLE.
    ${nodeName} The name of the node.
  • For more information about other parameters, see Scheduling parameters.