On the Workflow Parameters tab, you can assign a value to a variable or replace the value of a parameter for all nodes in the current workflow. This topic describes how to configure a workflow parameter. In this example, the value of the ReplaceMe parameter is replaced with ReplaceMe123 for all nodes in a manually triggered workflow.

Limits

  • In manually triggered workflows, ODPS SQL nodes, Shell nodes, and sync nodes support workflow parameters. The format for specifying a workflow parameter varies based on the node type. For example, a workflow parameter is specified as x=y1.
    • To configure the workflow parameter for an ODPS SQL node, double-click the node and click the General tab in the right-side navigation pane. On the General tab, enter x=aaa in the Arguments field. When the node is run, the value of the x parameter is replaced with y1. You can use ${x} to reference the workflow parameter in the code.
    • To configure the workflow parameter for a Shell node, double-click the node and click the General tab in the right-side navigation pane. On the General tab, enter $x in the Arguments field. When the node is run, the value of the x parameter is replaced with y1. You can use $1 to reference the workflow parameter in the code.
    • To configure the workflow parameter for a sync node, double-click the node and click the General tab in the right-side navigation pane. On the General tab, enter -p"-Dx=aaa" in the Arguments field. When the node is run, the value of the x parameter is replaced with y1. You can use ${x} to reference the workflow parameter in the code.
  • In auto triggered workflows, only ODPS SQL nodes support workflow parameters.
  • Before you use workflow parameters, you must configure the parameters of each single node in a workflow to ensure that each node is run as expected.
  • If the value that is assigned to a workflow parameter is inconsistent with the value that is assigned to a node parameter, the value of the workflow parameter overwrites the value of the node parameter.
  • Parameter names and values are case-sensitive.

Configure a workflow parameter

  1. Go to the DataStudio page.
    1. Log on to the DataWorks console.
    2. In the left-side navigation pane, click Workspaces.
    3. In the top navigation bar, select the region where your workspace resides, find the workspace, and then click Data Analytics in the Actions column.
  2. On the left-side navigation submenu, click the Manually Triggered Workflows icon.
  3. Double-click a manually triggered workflow. On the workflow configuration tab, click the Workflow Parameters tab in the right-side navigation pane.
  4. On the Workflow Parameters tab, enter ReplaceMe in the Parameter Name field and ReplaceMe123 in the Value/Expression field.
    Workflow Parameters
  5. On the workflow configuration tab, click the 1 icon in the top toolbar.

Configure the workflow parameter for an ODPS SQL node

  1. On the DataStudio page, click the Manually Triggered Workflows icon on the left-side navigation submenu.
  2. Click the required workflow and choose MaxCompute > Data Analytics. Double-click the required ODPS SQL node. The node configuration tab appears.
  3. Click the General tab in the right-side navigation pane. Enter ReplaceMe=123 in the Arguments field.
    Arguments

    The workflow parameter is specified as ReplaceMe=ReplaceMe123. When the workflow is run, the ReplaceMe parameter is assigned the value ReplaceMe123 for the node.

  4. On the workflow configuration tab, click the 1 icon in the top toolbar.

Configure the workflow parameter for a Shell node

  1. On the DataStudio page, click the Manually Triggered Workflows icon on the left-side navigation submenu.
  2. Click the required workflow and click General. Double-click the required Shell node. The node configuration tab appears.
  3. Click the General tab in the right-side navigation pane. Enter ${ReplaceMe} in the Arguments field.
    General
    Note Make sure that you specify the workflow parameter in the correct format for the Shell node.
  4. On the workflow configuration tab, click the 1 icon in the top toolbar.

Configure the workflow parameter for a sync node

  1. On the DataStudio page, click the Manually Triggered Workflows icon on the left-side navigation submenu.
  2. Click the required workflow and click Data Integration. Double-click the required sync node. The node configuration tab appears.
  3. Click the General tab in the right-side navigation pane. Enter -p"ReplaceMe=abc" in the Arguments field.
    The ReplaceMe parameter is assigned the value abc for the sync node. The workflow parameter is specified as ReplaceMe=ReplaceMe123. When the workflow is run, the ReplaceMe parameter is assigned the value ReplaceMe123 for the node, namely pt="ReplaceMe123".
    Note Make sure that you specify the workflow parameter in the -p"-DParameter name=Parameter value" format for the sync node.
  4. On the workflow configuration tab, click the 1 icon in the top toolbar.

Run the workflow and view the results

On the workflow configuration tab, click the Run icon in the top toolbar. When an auto triggered workflow is run, the values that are assigned to the parameters of nodes in the workflow are automatically replaced with the values of workflow parameters. When you run a manually triggered workflow on the DataStudio page, you must assign a value to each workflow parameter in the Enter parameters dialog box. In this example, assign a value to the ReplaceMe parameter.
  • Right-click the ODPS SQL node and select View Log. Then, you can view the value that is assigned to the ReplaceMe parameter for the ODPS SQL node.
  • Right-click the Shell node and select View Log. Then, you can view the value that is assigned to the ReplaceMe parameter for the Shell node.
  • Right-click the sync node and select View Log. Then, you can view the value that is assigned to the ReplaceMe parameter for the sync node.

If you have not assigned a value to a workflow parameter on the Workflow Parameters tab for a manually triggered workflow, you must assign a value to the workflow parameter every time you run the workflow in the production environment.