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
Supported 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
Log on to the DataWorks console. In the target region, click in the left-side navigation pane. Select a workspace from the drop-down list and click Go to Data Development.
-
On the DataStudio page, hover over the
icon and choose .Alternatively, open a workflow, right-click General, and choose .
-
In the Create Node dialog box, enter a Name and select a Path.
-
Click OK.
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 page of the parameter node, click Add Parameter.
-
Configure the Parameter name, Type, Value, and Description, and then click Save.
A note at the top of the page reminds you that any node referencing these parameters must be a direct descendant of this parameter node. The parameter types include Constant, Variable, and Pass-through Variable.
-
Constant: The parameter has a fixed value.
-
Variable: The parameter's value is dynamic. Select this type if you need to use system variables, such as the current time. For more information about supported formats, see Supported formats for scheduling parameters.
-
Pass-through Variable: Passes an output parameter from a direct ancestor node to a descendant node. For this type, you select the value from a list of all available output parameters from the direct ancestor nodes of this 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.
For the descendant node, go to the section. In the Input Parameters subsection, click Add. Enter the parameter name, select the value source, and then click Save. The settings are as follows:
-
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.