A parameter node is a special type of virtual node. This type of node is used to manage parameters in workflows and pass parameters between nodes. Parameter nodes can be used to manage constant and variable parameters and transparently pass the parameters of ancestor nodes. Nodes that need to use parameters can obtain parameters from parameter nodes. This topic describes how to create a parameter node.
Background information
Parameter nodes are virtual nodes. They do not run computing tasks. They are used to pass parameters between nodes and manage parameters in workflows.
Parameter passing between nodes
If Node A in a workflow needs to obtain the output parameters of its ancestor nodes, you can create a parameter node and use it as an ancestor node of Node A and a descendant node of the ancestor nodes of Node A. Then, add all the parameters required by Node A to the parameter node. This way, Node A can obtain all the required parameters from the parameter node.
In the preceding figure, the sql_7 node needs to obtain the output parameters of the sql_1, sql_3, and sql_4 nodes. A parameter node is created and used as a descendant node of the sql_1, sql_3, and sql_4 nodes and as an ancestor node of the sql_7 node. All the parameters required by the sql_7 node are added to the parameter node, and the sql_7 node can obtain all the required parameters from the parameter node.
Parameter management
If nodes in a workflow need to use some constant and variable parameters, you can create a parameter node and use it as an ancestor node of these nodes. Then, add all the parameters required by these nodes to the parameter node. This way, these nodes can obtain all the required parameters from the parameter node. The parameter node facilitates centralized management of all the parameters used in the workflow.
In the preceding figure, the sql_3, sql_4, sql_5, and sql_7 nodes need to use some parameters. A parameter node is created and used as an ancestor node of the sql_3, sql_4, sql_5, and sql_7 nodes. All the parameters required by these nodes are added to the parameter node, and these nodes can obtain all the required parameters from the parameter node.
Precautions
If a node needs to use parameters in a parameter node, the node must be a direct descendant node of the parameter node.
Limits
This type of node is supported in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), China (Chengdu), China (Hong Kong), Japan (Tokyo), Singapore, Malaysia (Kuala Lumpur), Indonesia (Jakarta), Germany (Frankfurt), UK (London), US (Silicon Valley), and US (Virginia).
Create a parameter node
Go to the DataStudio page.
Log on to the DataWorks console. In the top navigation bar, select the desired region. In the left-side navigation pane, choose . On the page that appears, select the desired workspace from the drop-down list and click Go to Data Development.
On the DataStudio page, move the pointer over the icon and choose .
Alternatively, find the required workflow in the Scheduled Workflow pane, click the workflow name, right-click General, and then choose
.In the Create Node dialog box, configure the Name and Path parameters.
Click Confirm.
Configure scheduling properties for the parameter node
After the parameter node is created, you can configure scheduling properties for the parameter node based on your business requirements.
Scheduling properties include basic properties, time properties, resource properties, and scheduling dependencies. A parameter node does not run data development tasks. It is used only to manage parameters and transparently pass parameters. Therefore, you must pay special attention to the scheduling dependencies configured for a parameter node.
If a node needs to use the parameters in a parameter node, the node must be a descendant node of the parameter node.
Ancestor nodes whose parameters need to be transparently passed must be the ancestor nodes of the parameter node.
For more information about how to configure scheduling properties for a parameter node, see Configure basic properties, Configure time properties, Configure the resource property, and Configure same-cycle scheduling dependencies.
Add parameters to the parameter node
After you configure scheduling properties for the parameter node, you can add the parameters that you want to manage and transparently pass to the parameter node for subsequent management and use. This section describes the procedure in detail.
On the configuration tab of the parameter node, click Add.
Specify Parameter name, Parameter Type, Value, and Description, and click Save.
The valid values of Type include Constant, Variable, and Pass-through variable.
Constant: indicates that the value of the parameter is a constant.
Variable: indicates that the value of the parameter is a variable. If you want to use a variable such as the system time, set the value of Type to Variable. For more information about variable parameters, see Supported formats of scheduling parameters.
Pass-through variable: Pass-through variables are used to transparently pass the output parameters of ancestor nodes of the parameter node to descendant nodes of the parameter node. If you add a parameter of the pass-through variable type, you can set Valid values to an output parameter of an ancestor node of the parameter node.
What to do next: Use the parameters in the parameter node
After you configure the parameter node, the descendant nodes of the parameter node can directly use the parameters in the parameter node. This facilitates centralized management of parameters and improves the task development efficiency of descendant nodes.
Before the descendant nodes of the parameter node can use the parameters in the parameter node, you must configure the parameters as the input parameters of the descendant nodes. This way, these parameters can be directly used in the code of the descendant nodes.
Configure the parameters as the input parameters of the descendant nodes.
On the configuration tab of a descendant node, click Properties in the right-side navigation pane. On the Properties tab, Click Create in the Input Parameters section of Input and Output Parameters to add the parameters required by the descendant node. The following parameters in the Input Parameters section must be specified:
Parameter Name: the name of the parameter that the descendant node needs to use. You can view the parameter name in the parameter node.
Value Source: the source of the parameter that the descendant node needs to use.
If the parameter information is not completely displayed, you can move the pointer over it to view the complete information. All the parameters that are added to the parameter node are displayed in the Output name of the parameter node:Parameter name format. You can select the source name that is ended with the name of the required parameter.
Use the parameters in the code of the descendant node.