ppmsetvar

sets or removes flow user variables, subflow user variables, and global user variables from a work item in a flow or subflow

Synopsis

ppmsetvar -f variable_name=value[ variable_name=value ...]
ppmsetvar -p variable_name=value[ variable_name=value ...]
ppmsetvar -g variable_name=value[ variable_name=value ...]
ppmsetvar -f -r variable_name[ variable_name ...]
ppmsetvar -p -r variable_name[ variable_name ...]
ppmsetvar -g -r variable_name[ variable_name ...]
ppmsetvar -h | -V

Description

This command is installed with IBM Spectrum LSF.

Use the ppmsetvar command to set user variables or remove user variables from a work item in a flow at runtime, and to set global user variables or remove global user variables at runtime.

You can use ppmsetvar only to set variables for LSF® jobs, job scripts, job arrays and job script arrays. You cannot use ppmsetvar to set variables for local jobs. To set variables for local jobs, use variable files.

This is a blocking command.

Important: This command uses the LSF bpost command with slots 4, 5, and 6. If anyone is using bpost in your LSF cluster, ensure the slots 4, 5, 6 are not used as this will interfere with the ppmsetvar command and may lead to unexpected results.

You can use ppmsetvar in conjunction with other methods of setting user variables in Process Manager, such as a variable file. For example, you could set some variables using ppmsetvar and other variables with a variable file. All user variables will be identified by Process Manager. If you use several methods to set user variables, note that the variable file can override any variables set with ppmsetvar as it is read last.

If ppmsetvar is used multiple times, the variables will be appended. For example, if you run the following, the end result will be a=10, b=2, c=7, and d=100:

ppmsetvar -f a=1 b=2
ppmsetvar -f a=10 c=7
ppmsetvar -f d=100

Options

-f variable_name=value [variable_name=value ...]

Sets user variables for a flow. Use this option to set user variables that can only be accessed by work items within a flow. These user variables cannot be accessed from other flows. Separate multiple variables with a space.

-p variable_name=value [variable_name=value ...]

Sets user variables from a subflow to be used in the parent flow. Use this option when you want to pass a user variable from a subflow to its parent flow. Separate multiple variables with a space.

-g variable_name=value [variable_name=value ...]

Sets global user variables for flows. Use this option to set a global user variable that is available to all flows in the system. Separate multiple variables with a space.

-f -r variable_name [variable_name ...]

Clears the specified user variable for work items within a flow. Separate multiple variables with a space.

-p -r variable_name [variable_name ...]

Clears the specified user variable for the parent subflow. Separate multiple variables with a space.

-g -r variable_name [variable_name ...]

Clears global user for flows. Separate multiple variables with a space.

Return Values

  • 0: command completed successfully.
  • 1: command exited due to an invalid parameter.
  • 2: command exited due to incorrect variable/value syntax.
  • 3: command exited due to unknown reasons.

Set user variables ABC and XYZ that can be accessed by all work items in a flow

ppmsetvar -f ABC=123 XYZ=456

Clear flow user variables ABC and XYZ

ppmsetvar -f -r ABC XYZ

Set a user variable from a subflow to a parent flow

For example, the subflow name is Dynamic_Subflow1. In this example, the job sets the user variable with the flow short name. The parent flow can access this user variable by indicating in a work item echo #{result_Dynamic_Subflow1}. In this case, the result of echo #{result_Dynamic_Subflow1} would be xyz100.

ppmsetvar -p result_#{JS_FLOW_SHORT_NAME}=xyz#{MYVAR}

Clear a user variable from a subflow

In this example, the subflow clears the user variable with the subflow short name in its parent subflow. If the subflow name is Subflow1, this command clear the user variable other_result_Subflow1.

ppmsetvar -p -r other_result_#{JS_FLOW_SHORT_NAME}

Set a global user variable from any work item

ppmsetvar -g MYGLOBAL=all

Clear a global user variable from any work item

ppmsetvar -g -r MYGLOBAL