You can reference the method that is used to configure scheduling parameters for SQL nodes, such as ODPS SQL nodes, to define custom variables and assign scheduling parameters to the custom variables for other types of nodes, excluding common Shell nodes and PyODPS nodes. Specific configurations differ for common Shell nodes and PyODPS nodes. This topic provides examples on how to configure scheduling parameters for different types of nodes.

SQL nodes and batch synchronization nodes

Scheduling parameters are configured for SQL nodes and batch synchronization nodes by using a method that is suitable for most types of nodes. Therefore, you can reference this method to configure scheduling parameters for most types of nodes. In this section, an ODPS SQL node is used. This section describes how to assign custom parameters to custom variables, and how to reference the custom variables in code.
Note Some nodes do not support scheduling parameters. For more information about whether a type of node supports scheduling parameters, see the documentation of the type of node.
Assign custom parameters to custom variablesIn the preceding figure, custom parameters are assigned to the custom variables var1, var2, var3, var4, and var5 in the Parameters section and the custom variables are referenced in the code editor. In this example, the following variables are defined:
  • var1: Specify $bizdate as var1. This variable is used to obtain the data timestamp. $bizdate is a built-in system parameter.
  • var3: Specify $cyctime as var3. This variable is used to obtain the scheduling time. $cyctime is a built-in system parameter.
  • var2: Specify ${yyyymmdd} as var2. This variable is used to obtain the data timestamp.
  • var4: Specify $[yyyymmddhh24:mi:ss] as var4. This variable is used to obtain the scheduling time.
  • var5: Assign the constant abc to this variable.
For more information about how to configure and use scheduling parameters, see Configure and use scheduling parameters. For more information about how to assign custom parameters to custom variables, see Overview of scheduling parameters.

PyODPS nodes

To avoid code changes, a PyODPS node does not allow you to replace defined variables with strings that are in the ${param_name} format in the code. However, you can add a dictionary object named args to the global variable before the code is run. This way, the PyODPS node can obtain the values of scheduling parameters from the dictionary object. Configure scheduling parameters for a PyODPS nodeIn the preceding figure, custom parameters are assigned to the custom variables var1, var2, and var3 in the Parameters section, a dictionary object named args is added, and then the custom variables are referenced in the formats of args['var1'], args['var2'], and args['var3'] in the code editor. In this example, the following variables are defined:
  • var1: Specify $bizdate as var1. This variable is used to obtain the data timestamp. $bizdate is a built-in system parameter.
  • var2: Specify ${yyyymmdd} as var2. This variable is used to obtain the data timestamp.
  • var3: Specify $[yyyymmdd] as var3. This variable is used to obtain the data timestamp.
For more information about how to configure and use scheduling parameters, see Configure and use scheduling parameters. For more information about how to assign custom parameters to custom variables, see Overview of scheduling parameters.

Common Shell nodes

You are not allowed to customize variable names for common Shell nodes. The variables must be named based on their ordinal numbers, such as $1, $2, and $3. If the number of parameters reaches or exceeds 10, use ${Number} to declare the excess variables. For example, use ${10} to declare the tenth variable. Configure scheduling parameters for a common Shell nodeIn the preceding figure, custom parameters are assigned to the custom variables $1, $2, and $3 in the Parameters section, and the custom variables are referenced in the code editor. In this example, the following variables are defined:
Note For common Shell nodes, you can assign custom parameters to custom variables only by using expressions. Separate multiple custom parameters with spaces. Make sure that you assign the custom parameters to the custom variables in the same order in which the custom variables are defined. For example, the first parameter $bizdate that you enter in the Parameters section is assigned to the first variable $1.
  • $1: Specify $bizdate as $1. This variable is used to obtain the data timestamp. $bizdate is a built-in system parameter.
  • $2: Specify ${yyyymmdd} as $2. This variable is used to obtain the data timestamp.
  • $3: Specify $[yyyymmdd] as $3. This variable is used to obtain the data timestamp.
For more information about how to configure and use scheduling parameters, see Configure and use scheduling parameters. For more information about how to assign custom parameters to custom variables, see Overview of scheduling parameters.