Setting up conditional dependencies

You can set up conditional dependencies to define workflows with alternative branches based on conditions.

Using conditional dependencies, you can control when a successor job starts depending on the combination of one or more mapping expressions (for example, return codes) or statuses of a predecessor job.

Example:

The DB_BACKUP job runs if the ABSENCES job satisfies the condition associated with STATUS_OK. The OPERATOR_INTERVENTION job runs if the ABSENCES job satisfies the condition defined for STATUS_ERR1.


The predecessor job Absences has an internal conditional dependency on DB_BACKUP

The predecessor job Absences has an internal conditional dependency on OPERATOR_INTERVENTION
To set up this type of job processing, create the ABSENCES job definition and define the conditional dependencies.
  1. Create the ABSENCES job definition:
    1. Open the Dynamic Workload Console.
    2. From the Design menu, select Graphical Designer.
    3. Create a new workspace.
    4. From the canvas, select the Assets tab and click the Add button (+).
    5. From the drop-down menu, select Job definition.
    6. In the search bar, select a job type and click Next.
    7. Define information about the job, and name it ABSENCES.
  2. Define the conditional dependencies:
    1. In the Output conditions section, under Successful output conditions, click the Add button (+).
    2. Enter STATUS_OK as condition name, and set RC=0 as condition value.
    3. In Other output conditions, click the Add button (+).
    4. Enter STATUS_ERR1 as condition name, and set RC=2 as condition value.
    5. Click Add to add the job definition to the database.
  3. Create the DB_BACKUP and the OPERATOR_INTERVENTION jobs.
  4. Create the PAYROLL job stream:
    1. From the Blocks tab, drag a job stream onto the canvas, name it PAYROLL and define information about it.
  5. Add the ABSENCES, DB_BACKUP and OPERATOR_INTERVENTION jobs to the PAYROLL job stream:
    1. From the Assets tab, drag the ABSENCES, DB_BACKUP and the OPERATOR_INTERVENTION jobs onto the PAYROLL job stream.
  6. Define the internal conditional dependencies:
    1. From the ABSENCES job block, drag a connecting arrow to the DB_BACKUP connection point.
    2. From the Internal predecessor panel, in General information, expand the Output conditions menu and select STATUS_OK.
    3. From the ABSENCES job block, drag a connecting arrow to the OPERATOR_INTERVENTION connection point.
    4. From the Internal predecessor panel, in General information, expand the Output conditions menu and select STATUS_ERR1.
You can define the same scenario by using Orchestration CLI:
Job definition
WK1#ABSENCES
  SCRIPTNAME "myscript.sh"
  STREAMLOGON root
  DESCRIPTION "Sample Job Definition"
  TASKTYPE UNIX
  SUCCOUTPUTCOND  STATUS_OK "RC=0”
  OUTPUTCOND STATUS_ERR1 “RC =2”
    RECOVERY CONTINUE
END
Job stream
SCHEDULE WK1#PAYROLL 
ON RUNCYCLE RULE1 "FREQ=DAILY;"
AT 1800
CARRYFORWARD
:
WK1#DB_BACKUP
  FOLLOWS WK1#ABSENCES IF STATUS_OK 
WK1#OPERATOR_INTERVENTION
  FOLLOWS WK1#ABSENCES IF STATUS_ERR1
END 
For more information about defining conditional dependencies using Orchestration CLI see Job definition, Job stream definition, and follows.