A parameter node is a special type of zero load node used to manage parameters in a business flow and pass them between task nodes. It supports constant parameters, variable parameters, and pass-through parameters from ancestor nodes. Task nodes that need to reference these parameters can directly depend on the parameter node. This topic describes how to create a parameter node to help you use DataWorks for efficient data development.
Background information
A parameter node is a zero load node that does not run computing tasks or generate data. It is primarily used for cross-node parameter passing and parameter management.
Cross-node parameter passing
If a task of a descendant node in a data development flow needs to obtain output parameters from multiple ancestor nodes at different levels, you can use a parameter node to consolidate all the required parameters. The descendant node can then be attached directly to the parameter node to obtain all the necessary parameters.
In the preceding figure, the sql_7 node needs to obtain the output parameters of the sql_1, sql_3, and sql_4 nodes. In this case, you can create a parameter node as a descendant node of sql_1, sql_3, and sql_4. Add all parameters required by sql_7 to the parameter node. Then, attach sql_7 as a descendant of this parameter node. This allows sql_7 to directly obtain all required parameters from the parameter node.Parameter management
If tasks of descendant nodes in a data development flow need to use constant or variable parameters, you can use a parameter node to add all the required parameters. The descendant nodes can then be attached directly to the parameter node to obtain the parameters. This facilitates the centralized management of all parameters used in the business flow.
In the preceding figure, the sql_3, sql_4, sql_5, and sql_7 nodes all need to use parameters. In this case, you can create a parameter node and add the parameters used by each descendant node to it. Then, attach the nodes that require the parameters as descendants of this parameter node.
Note
When a task node references a parameter in a parameter node, it must be a direct descendant of the parameter node in the business flow. You must set the parameter node as an upstream dependency for the task 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
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 Data Development page, hover over the
icon and click . Alternatively, open a business flow, right-click General, and select .
In the New Node dialog box, you can enter a Name and select a Path.
Click Confirm.
Configure scheduling
After you create a parameter node, you must configure its scheduling properties based on your scenario.
Scheduling configurations include basic properties, time properties, resource properties, and scheduling dependencies. A parameter node does not run data processing tasks. It is used only for parameter management and pass-through. Therefore, when you configure scheduling for a parameter node, you should focus on its scheduling dependencies:
A task node that uses parameters from a parameter node must be a downstream dependency of the parameter node.
An ancestor node that generates pass-through parameters must be an upstream dependency of the parameter node.
For more information about how to configure scheduling, see Configure basic properties, Configure time properties, Configure resource properties, and Configure same-cycle scheduling dependencies.
Add parameters
After you configure scheduling for the parameter node, add the parameters that you want to manage or pass through. Follow these steps:
On the parameter node editing page, click Add Parameter.
Configure Parameter Name, Type, Value, and Description, and click Save.
The available parameter types are Constant, Variable, and Pass-through Variable.Constant: The parameter has a static field.
Variable: You can set the parameter type to Variable to use a variable, such as the system time, as the parameter value. For more information about variable parameters, see Supported formats of scheduling parameters.
Pass-through Variable: A pass-through variable is primarily used to pass the output parameters of an ancestor node to a descendant node. For the parameter value, you can select any output parameter of the ancestor nodes that are specified as scheduling dependencies of the parameter node.
What to do next: Use parameters in a descendant node
After you configure the parameter node, you can directly use the parameters from the parameter node in its descendant nodes. This helps you manage parameters in a centralized manner and improves the development efficiency for tasks in descendant nodes.
When a descendant node uses a parameter from a parameter node, you must first reference the parameter in the context settings of the descendant node. Then, you can use the parameter in the task code.
Set the context for the descendant node.
On the descendant node's tab, click Add in the Input Parameters of This Node section to add the required parameters.
The following table describes the parameters:Parameter Name: The name of the parameter to use. You can view the parameter name in the parameter node.
Value Source: Select the source parameter from the desired parameter node.
If the content is too long to be fully displayed, you can point to a value source to view the complete source information. The available value sources are all parameters from the ancestor nodes of the current node. The format is Node Output Name: Parameter Name. You can use the parameter name suffix to quickly find a specific value source.
Use the parameter in the code of the descendant node.