Hitachi

JP1 Version 12 JP1/Automatic Job Management System 3 System Design (Work Tasks) Guide


2.4.6 Executing a specific process when a job ends abnormally (example of defining a jobnet that uses a recovery unit)

Use a recovery unit when defining a jobnet in which a process is executed only if a job ends abnormally.

You can set a recovery unit by entering Recovery in Type in the Attributes definition of the job or jobnet. Any job or jobnet can be set the recovery attributes.

Organization of this subsection

(1) Example of defining a jobnet that uses a recovery job

In the example below, a recovery job is used in defining a jobnet that performs a stock check, and then creates an order entry form if there is adequate stock. If there is insufficient stock, the stock check job ends abnormally, a purchase order form is created, and then the order entry form is created.

Figure 2‒91: Example of defining a jobnet that uses a recovery job

[Figure]

In this example, the stock check job returns 5 or a higher value if the execution result indicates a stock shortage.

First, set Judgment by threshold as the end judgment of the stock check job and set the abnormal threshold to 4. (That is, the stock check job ends normally if the return code is 4 or lower, or ends abnormally if the return code is 5 or higher.) If the stock check job ends normally, the create order entry form job will be executed next. Therefore, leave Normal (default) as the create order entry form job's Type setting. If the stock check job ends abnormally, the create purchase order form job will be executed next. Therefore, set Recovery in Type in the Attributes definition of the create purchase order form job. When this job ends, the create order entry form-R job will be executed. Set Recovery in Type for this job too (because only a recovery unit can be defined as the succeeding unit of a recovery unit).

Accordingly, the succeeding job of the stock check job is as follows:

Note that when a recovery unit is executed (because the preceding job ended abnormally), even if that recovery unit ends normally, the entire jobnet in which those units are defined is assumed to have ended abnormally. Also, if no preceding job is defined, the recovery unit is not be executed and is set to Not executed + Ended status.

Supplementary note

When you define an OR job as a recovery job, you must define its preceding event jobs and its succeeding job as recovery jobs.

(2) Example of defining multiple preceding jobs for a recovery unit

You can define multiple preceding jobs for a recovery unit. In this case, the recovery unit will be executed only if all the preceding jobs end abnormally. An example of defining multiple preceding jobs for a recovery job is shown below.

Figure 2‒92: Example of defining multiple preceding jobs

[Figure]

In this example, recovery job A is executed only if standard jobs A, B, and C all end abnormally. Recovery job B is executed following normal termination of recovery job A.

(3) Example of defining a jobnet that reruns the succeeding unit of an abnormally ended unit

When the succeeding unit of an abnormally ended unit is rerun, re-execution might fail depending on the timing. You can prevent such a failure by specifying the -rr, -rn, and -ri options for the ajsrerun command. If the command is run from a recovery unit, re-execution can be retried while the target unit is not ended. The following figure shows an example of defining a jobnet that reruns the succeeding unit of an abnormally ended unit.

Figure 2‒93: Example of defining a jobnet that reruns the succeeding unit of an abnormally ended unit

[Figure]

In this example, when standard job A ends abnormally, recovery job A uses the ajsrerun command to rerun standard job C. Recovery job A retries re-execution while standard job C has not ended.

For details about re-execution from a recovery unit, see 4.5.11 Rerunning a job or jobnet in the manual JP1/Automatic Job Management System 3 Overview.

For details on the ajsrerun command, see ajsrerun in 3. Commands Used for Normal Operations in the manual JP1/Automatic Job Management System 3 Command Reference.

Cautionary note

When the succeeding unit of an abnormally ended unit is rerun, if many retries are executed at short intervals, job execution might be adversely affected. To avoid this, note the following points when defining re-execution in a recovery unit:

  • We recommend that you use the defaults for the retry count and interval for re-execution. If you change the retry count and interval, before doing so, measure and verify the processing time in the environment in which the system is actually used and set values that are not likely to affect the job execution. Note that a jobnet ends after all its subordinate units end. You must take this into account in cases such as where you measure the time required when a unit abnormally ends, and its succeeding units are placed in Not executed + Ended status. In this case, you must measure the length of time until the upper-level jobnet abnormally ends after all the succeeding units are placed in Not executed + Ended status. After measuring the time in this way, determine the proper retry count and interval for re-execution according to the system operation.

  • If re-execution of multiple units needs to be retried sequentially or simultaneously, set a longer retry interval.

  • For the execution agents of recovery jobs that run the ajsrerun command with the -rr, -rn, and -ri options, if necessary, set the maximum number of concurrently executable jobs to prevent concurrent execution of many instances of that command.