Condition-based workload automation

Condition-based workload automation provides a simple and immediate way to have your workflows start at just the right time. You can define in your job stream a start condition that, when met, releases the job stream to run as scheduled.

For example, if you have a job stream containing jobs which analyze one or more files, you can have the job stream start only after the file or files have been modified or created. Also, you can condition the job stream to the output condition of a specific job: the job stream starts only when the specified output condition is met. For example, if the job stream contains jobs which process the data in a database, you might want to have the job stream start after a new row has been written into the database.

You can start your workflow based on one of the following conditions:
  • One or more files being created
  • One or more files being modified
  • A job completing with its output condition satisfied
For conditions based on files being created or modified, when you save the job stream, a monitoring job is automatically created to monitor the specified condition. This job becomes the first job in the job stream and remains in EXEC status until the condition it is monitoring is met or the job's deadline expires.
Note: If you do not specify a deadline, by default the value is defined using the startConditionDeadlineOffset optman option.
This job type is identified by the +AUTOGEN+ label in the command line and by an icon with the A character in the Dynamic Workload Console.
For conditions based on the result of a specified job, when you save the job stream, the job becomes the first job in the job stream and restarts until the condition is satisfied, or the job's deadline expires.
Note: If you do not specify a deadline, by default the value is defined using the startConditionDeadlineOffset optman option.
This applies also if the job completes in Success status. This is the monitoring job. When you specify this condition type, IBM® Workload Scheduler automatically defines a success output condition on the monitoring job. As a result, the monitoring job completes successfully when any of its output conditions is satisfied, including the condition on the monitoring job itself. You can apply this logic to the job stream or to specific jobs in the job stream. For more information about output conditions, see Applying conditional branching logic.

When the condition is met, the job completes successfully and releases the remaining part of the job stream. When the job's deadline expires without the condition being met, the job stream is suppressed.

In the Graphical Designer, you define condition-based workload automation in the Start Condition tab when creating a job stream. You can select the type of condition you want to monitor and specify the related settings. For more information, see A business scenario and the online help. From the composer command line, you can define the start condition in the job stream definition. For more information, see Job stream definition.

By default, IBM Workload Scheduler keeps monitoring the condition also after it is first met. This is accomplished by automatically creating a new Job Stream Submission job and adding it to the job stream as a successor of the monitoring job. This job type is identified by the +AUTOGEN+ label in the command line and by an icon with the A character in the Dynamic Workload Console. To have IBM Workload Scheduler stop when the condition is first met, select the Start once check box in the Graphical Designer, or omit the rerun keyword in the composer command line.

The Job Stream Submission job is defined on a specific pool workstation named MASTERAGENTS. This pool workstation contains the dynamic agent installed on the master domain manager and on the backup domain manager, if present. The dynamic agent installed on the master domain manager and backup domain manager (if present) are automatically added at installation time to this pool workstation. If you delete the MASTERAGENTS pool workstation and then recreate it, you must stop and restart the dynamic agent to add it back to the MASTERAGENTS pool workstation. See Automatically register agents to pools for more information about the MASTERAGENTS pool workstation.
Note: The default name for the pool workstation, MASTERAGENTS, can be modified using the optman global option resubmitJobName. See Global options - detailed description for details about this option.

The Job Stream Submission job creates a new instance of the job stream in which the start condition is defined. By default, the new job stream instance starts also if the previous instance is still running and the two instances run concurrently. To change this behavior, in the Graphical Designer, switch to the Scheduling options tab and select Queue the new instance in the Actions section. From the composer command line, use the onoverlap keyword. For more information, see onoverlap. The newly-generated instance is identical to the previous one it and is set to repeat the condition check, therefore a series of new instances is created until the job stream's deadline expires.

Figure 1 illustrates the details of the default process. If you select the Start once check box, the process stops after the condition is first met, therefore the steps within the dotted line in the graphic are not performed.
Figure 1. Condition-based workload automation
Describes the flow of the objects being created for condtion-based worflow automation

The monitoring job, the Job Stream Submission job, and the additional instances of the job stream, are not visible in the database, but are visible in the plan, so that you can check on the progress of the plan. In the Dynamic Workload Console, you can check the progress of the plan by the Monitor workload view, and in the conman command line, you can use the showjobs command.