A parameter node is a special virtual node that allows you to manage parameters within a workflow and pass them between task nodes. It supports constant parameters, variable parameters, and passing through parameters from upstream nodes. Nodes that require parameters can simply establish a dependency on the parameter node. This topic describes how to create a parameter node for efficient data development in DataWorks.
Overview
A parameter node is a virtual node that does not run data computation tasks or produce data. It is primarily used for cross-node parameter passing and centralized parameter management.
Pass parameters between nodes
In a workflow, if a downstream node requires output parameters from multiple upstream nodes across various levels, you can use a parameter node to consolidate them. Add all required parameters to the parameter node. Then, set the downstream node to depend directly on the parameter node to access all the parameters it needs.
In the figure above, the
Sq_MySQL_Gnode requires the output parameters from theSq_MySQL_BandSq_MySQL_Enodes. You can use a parameter node as a downstream node for bothSq_MySQL_BandSq_MySQL_E. Add all parameters thatSq_MySQL_Gneeds to the parameter node. Then, setSq_MySQL_Gas a downstream node of the parameter node to receive its output parameters. This way,Sq_MySQL_Gcan obtain the parameters fromSq_MySQL_BandSq_MySQL_Evia the parameter node.Centralized parameter management
When downstream task nodes in a workflow need to use certain constant or variable parameters, you can add all these parameters to a single parameter node. The downstream nodes that require these parameters can then depend directly on the parameter node. This approach centralizes parameter management for the workflow.
In the figure above, the
Sq2_MySQL_A,Sq2_MySQL_C,Sq2_MySQL_D,Sq2_MySQL_E, andSq2_MySQL_Fnodes all require parameters. You can use a parameter node to obtain output parameters from upstream nodes and configure necessary variable or constant parameters. This parameter node then serves as the upstream dependency for the nodes that require these parameters.
Prerequisites
The RAM user that you want to use is added to your workspace.
If you want to use a RAM user to develop tasks, you must add the RAM user to your workspace as a member and assign the Develop or Workspace Administrator role to the RAM user. The Workspace Administrator role has more permissions than necessary. Exercise caution when you assign the Workspace Administrator role. For more information about how to add a member and assign roles to the member, see Add members to a workspace.
A serverless resource group is associated with your workspace. For more information, see the topics in the Use serverless resource groups directory.
Before you can configure a parameter node, you must create one. For more information, see Create nodes for a scheduling workflow.
Note
To reference parameters from a parameter node, a task node must be its direct downstream node and set the parameter node as an upstream dependency.
Step 1: Configure the parameter node
You can create constant parameters, variable parameters, and pass-through variables in a parameter node. The following sections describe how to configure these three types of parameters.
Add a constant parameter
A constant parameter has a fixed value that you can configure directly in the parameter node.
Open the parameter node editor and click the add parameter button in the upper-left corner to add a parameter.
Configure the constant parameter:
Parameter
Description
Parameter name
A custom parameter name.
NoteThis name is used for selection when downstream nodes add parameters.
Parameter type
Constant.
Value
A custom constant value based on your business requirements.
Description
A description of the parameter based on your business requirements.
After you configure the constant parameter, click Save in the Actions column to save the parameter.
Add a variable parameter
If the parameter value is a variable, such as a system time variable, set the parameter type to variable when you add the parameter.
Open the parameter node editor and click the add parameter button in the upper-left corner to add a parameter.
Configure the variable parameter:
Parameter
Description
Parameter name
A custom parameter name.
NoteThis name is used for selection when downstream nodes add parameters.
Parameter type
Variable.
Value
A custom variable value based on your business requirements.
NoteFor more information about variable parameters, see Configure scheduling parameters.
Description
A description of the parameter based on your business requirements.
After you configure the variable parameter, click Save in the Actions column to save the parameter.
Add a pass-through variable parameter
A pass-through variable is used to pass output parameters from upstream nodes to downstream nodes. Its value can be set to any output parameter of the upstream dependency nodes specified in the schedule settings of the parameter node.
Open the parameter node editor and click schedule settings on the right side. In , click Add Dependency and configure the node whose parameters you want to pass through as an upstream dependency.
After you configure the dependency, switch to Scheduling Parameters and click Add parameters. Configure the following settings:
Enter a custom name for the new parameter.
Click the
button to search for and associate an output parameter from an upstream node.
After you finish configuring the parameters, close the schedule settings panel. On the parameter node page, click Add and configure the following settings:
Parameter
Description
Parameter name
A custom parameter name.
NoteThis name is used for selection when downstream nodes add parameters.
Parameter type
Pass-through variable.
Value
Select an upstream parameter that was associated in the schedule settings from the drop-down list.
Description
A description of the parameter based on your business requirements.
After you configure the pass-through variable parameter, click Save in the Actions column to save the parameter.
After you finish configuring the parameters for the parameter node, configure its schedule settings. For more information, see Configure schedule settings.
Step 2: Use parameters in downstream nodes
After you configure the parameter node, you can directly use its parameters in downstream nodes for centralized parameter management and improved development efficiency.
To use parameters from a parameter node in a downstream node, you must add parameters in the scheduling parameters of the downstream node to associate them with the parameter node.
Associate the upstream parameter node parameters.
Open the parameter node editor and click schedule settings on the right side. In , click Add Dependency and configure the parameter node as an upstream dependency.
After you configure the dependency, switch to Scheduling Parameters and click Add parameters. Configure the following settings:
Enter a custom name for the new parameter.
Click the
button to search for and associate an output parameter from the upstream parameter node.
After you configure the parameters, you can reference them in the node script by using
${parameter name}to obtain the parameters passed from the parameter node.
Step 2: Deploy and manage the node
After you complete the schedule settings, you can submit and deploy the node along with its upstream and downstream nodes to the production environment. For more information, see Deploy nodes.
After deployment, the task runs periodically based on the schedule you configured. You can view the deployed scheduled tasks and perform O&M operations in . For more information, see Manage scheduled tasks.