![Start of change](../../delta.gif)
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.
- 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. 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. 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 Workload 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 check the condition just one time and stop when it is first met, select the Start once check box in the Workload Designer, or omit the rerun keyword in the composer command line.
![Start of change](../../delta.gif)
![End of change](../../deltaend.gif)
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 Workload 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.
![Describes the flow of the objects being created for condtion-based worflow automation](awsrgtriggerworkflow.gif)
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.
![End of change](../../deltaend.gif)