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 by assuming that you want to replace the value of the ReplaceMe parameter with ReplaceMe123 in a manually triggered workflow.

Note

  • In manually triggered workflows, ODPS SQL nodes, Shell nodes, and sync nodes support global parameters. The format for specifying a global parameter varies according to the node type. For example, a global workflow parameter is specified as x=y1.
    • To configure the workflow parameter for an ODPS SQL node, double-click the target node and click the General tab in the right-side navigation pane. On the General tab that appears, enter x=aaa in the Arguments field. When the node is run, the workflow parameter configuration is replaced with x=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 target node and click the General tab in the right-side navigation pane. On the General tab that appears, enter $x in the Arguments field. When the node is run, the workflow parameter configuration 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 target node and click the General tab in the right-side navigation pane. On the General tab that appears, enter -p"-Dx=aaa" in the Arguments field. When the node is run, the workflow parameter configuration is replaced with -p"-Dx=y1. You can use $x to reference the workflow parameter in the code.
  • In auto triggered workflows, only ODPS SQL nodes support global parameters.
  • Parameter names and values are case-sensitive.

Configure a workflow parameter

  1. Log on to the DataWorks console. In the left-side navigation pane, click Workspaces. On the Workspaces page, find the target workspace and click Data Analytics in the Actions column.
  2. On the DataStudio page, click Manually Triggered Workflows in the left-side navigation pane. Double-click the target workflow to go to the configuration page.
  3. In the right-side navigation pane, click the Workflow Parameters tab. On the Workflow Parameters tab that appears, enter ReplaceMe in the Parameter Name field and ReplaceMe123 in the Value/Expression field.
  4. Click Save.

Configure the workflow parameter for an ODPS SQL node

  1. On the DataStudio page, click Manually Triggered Workflows in the left-side navigation pane.
  2. Find the target workflow and choose MaxCompute > Data Analytics to show all the existing data analytics nodes. Find the target ODPS SQL node and double-click it to go to the configuration page.
  3. In the right-side navigation pane, click the General tab. On the General tab that appears, enter ReplaceMe=123 in the Arguments field.

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

  4. Click the 1 icon in the toolbar to save the configuration.

Configure the workflow parameter for a Shell node

  1. On the DataStudio page, click Manually Triggered Workflows in the left-side navigation pane.
  2. Find the target workflow and click General to show all the existing data analytics nodes. Find the target Shell node and double-click it to go to the configuration page.
  3. In the right-side navigation pane, click the General tab. On the General tab that appears, enter ${ReplaceMe} in the Arguments field.
    Note Make sure that you enter the parameter in the correct format.
  4. Click the 1 icon in the toolbar to save the configuration.

Configure the workflow parameter for a sync node

  1. On the DataStudio page, click Manually Triggered Workflows in the left-side navigation pane.
  2. Find the target workflow and click Data Integration to show all the existing data integration nodes. Find the target sync node and double-click it to go to the configuration page.
  3. In the right-side navigation pane, click the General tab. On the General tab that appears, enter -p"ReplaceMe=abc" in the Arguments field.
    Note Make sure that you enter the parameter in the correct format, that is, -p"-DParameter name=Parameter value".
  4. Click the 1 icon in the toolbar to save the configuration.

Run the workflow to view the result

On the configuration page of the workflow, click the Run icon in the toolbar. In the Enter parameters. dialog box that appears, assign the specified value to the ReplaceMe parameter. The value of the workflow parameter is replaced when the workflow is run.

  • Right-click the ODPS SQL node and select View Log. Then, you can view the value assigned to the workflow parameter for the ODPS SQL node.
  • Right-click the Shell node and select View Log. Then, you can view the value assigned to the workflow parameter for the Shell node.
  • Right-click the sync node and select View Log. Then, you can view the value assigned to the workflow 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.