SCHEDULE
Automated Job Submission System
Guide and Reference Manual


Previous Contents Index


Chapter 5
An Example

Included with the SCHEDULE System are some predefined calendars and a procedure to create some demonstration jobs1. The demonstration jobs are grouped into subdirectories of the /demo/ directory.

The jobs grouped into the /demo/d/ subdirectory are configured to simulate the task of the daily updating of a database. This job sequence is divided into three groups of jobs. In brief, the first group backs up the database, the second group updates the database, and the third group does the final reporting on the results of the database update.

The first part of this section describes the job flow for the daily database update, identifying each job and describing the function of that job. The next part of this section gives the complete set of commands to create and configure each job. The last part of this section describes running the job sequence and reviewing the events that occurred during execution.

In this section, commands will be used to illustrate how the daily database update job sequence was created, configured, and run.

Note

1 To build the demonstration jobs, issue the following command:@SCHEDULE_LIBRARY:SCHEDULE_DEMO.

5.1 Outline of job flow

The complete job flow of the three groups of jobs is shown in Figure 5-1 Complete Job Flow.

Figure 5-1 Complete Job Flow


The first group consists of three sequential jobs to back up the database, as shown in Figure 5-2 First Group of Jobs.

Figure 5-2 First Group of Jobs


Every day at a preset time, job A1 is scheduled to be submitted and run. When run, job A1 checks to see if the database is available for updating. If this check fails, the complete job sequence is exited. If the check succeeds, job A2 is initiated. Job A2 backs up the database to allow for recovery from errors in the subsequent updating of the database. When job A2 successfully completes, job A3 is initiated. Job A3 does no operation but just serves as a return point used in error recovery. Since job A3 does no operation, it always succeeds and initiates job B1, the first job of the second group. The second group consists of five sequential jobs to update the database and three jobs used in error recovery, as shown in Figure 5-3 Second Group of Jobs.

Figure 5-3 Second Group of Jobs


Job B1 does the initial update of the database. Upon successful completion, job B21 is initiated to do the main update to the database. If this job fails, job C is initiated. Job C restores some of the database from the backup files and then initiates jobs in the third group of jobs. If job B21 succeeds, job B22 is initiated to sort the output of the database update. If job B22 fails due to the disk being full, job D is initiated. Job D purges files and then initiates job B22 again. This loop continues until job B22 succeeds. Upon job B22 succeeding, job B23 is initiated to do the final processing in the database update. If this fails, job E is initiated.

Job E completely restores the database from the backup files and then initiates the last job of the first group, job A3, to start another pass at updating the database. If job B23 succeeds, job B24 is initiated. Job B24 prints out the results for the successful database update and then initiates jobs in the third group of jobs.

The third group consists of two jobs which together control the initiation of three sequential jobs to do the final reporting on the results of the database update, as shown in Figure 5-4 Third Group of Jobs.

Figure 5-4 Third Group of Jobs


The normal initiation of jobs in the third group occurs when job B24 from the second group of jobs succeeds, at which time both job F and job G are initiated. Job F prepares a report on the database status. Job G updates the snapshot of the database at remote nodes. When job G successfully completes, job H is initiated, but since job F is a prerequisite for job H, job H must wait until job F successfully completes.

The abnormal initiation of jobs in the third group occurs when job C from the second group successfully completes, at which time both job F and job H are initiated. Again, job H must wait until job F successfully completes since job F is a prerequisite for job H.

Job H prints out a report on the snapshot status at the remote nodes. When job H successfully completes, job I is initiated. Job I updates the weekly summarization data report. If job I succeeds, the complete task has finished. If job I fails, job J is initiated to log this failure.

5.2 Create and configure jobs

In this section, commands are used to illustrate how the daily database update job sequence was created and configured.

5.2.1 Create directory and jobs

As the first step, directory /demo/d/ and each of the jobs must be created.

To create the /demo/d/ directory for the job sequence, use the following command:


 
 
Schedule> mkdir /demo/d/ 
 
 

To create the jobs for the daily database update, use the following commands:


 
 
Schedule> mkjob /demo/d/a1- 
_$-general=comment:"Startup check before database" 
Schedule> mkjob /demo/d/a2- 
_$-general=comment:"Backup the database" 
 
   .
   .
   .
 
Schedule> mkjob /demo/d/i- 
_$-general=comment:"Update weekly summarization report data" 
Schedule> mkjob /demo/d/j- 
_$-general=comment:"Log failure of weekly summarization update" 
 
 

To confirm which jobs have been created, use the following commands:


 
 
 
Schedule> lsjob /demo/d/* 
 
Job directory /demo/d/ 
 
 
 
A1 A2 A3 B1 
B21 B22 B23 B24 
C D E F 
G H I J 
 
Total of 16 jobs 
 
 
Schedule> lsjob /demo/d/* -general=comment 
 
job directory /demo/d/ 
 
 
 
A1 Startup check before database update 
A2 Backup the database 
A3 Place holder for after backup the database 
B1 Initial update of the database 
B21 Main update to the database 
B22 Sort the output of database update 
B23 Final processing of database update 
B24 Print out results of successful database update 
C Restore some of database from backup files 
D Purge files to make room for database sort output 
E Restore backup to allow retry 
F Prepare report on database status 
G Update snapshot of database at remote nodes 
H Print out report of snapshot update 
I Update weekly summarization report data 
J Log failure of weekly summarization update 
 
Total of 16 jobs 
 

5.2.2 Configure initiate and prerequisite relationships

To configure the job flow as shown in Figure 5-1 Complete Job Flow, the initiate and prerequisite relationships between jobs must be established.

To edit the initiate list for each job, use the following command:


 
Schedule> edjob /demo/d/b21 -initiates 
 
 

Within the editor, enter the jobs to be initiated by this job:


 
B22,SUCCESS 
C,FAILURE 
 

To edit the prerequisite list for job H, which is the only job that requires a prerequisite, follow the same procedure using prerequisites in place of initiates within the command.

To view the initiate and prerequisite lists, use the following commands:


 
 
Schedule> more /demo/d/* -initiates 
 
/demo/d/a1/initiates 
a2,success 
/demo/d/a2/initiates 
a3,success 
/demo/d/a3/initiates 
b1,success 
/demo/d/b1/initiates 
b21,success 
/demo/d/b21/initiates 
c,fatal 
b22,success 
/demo/d/b22/initiates 
d,code=7389215 
b23,success 
/demo/d/b23/initiates 
e,fatal 
b24,success 
/demo/d/b24/initiates 
g,success 
f,success 
/demo/d/c/initiates 
h,success 
f,success 
/demo/d/d/initiates 
b22,success 
/demo/d/e/initiates 
a3,success 
/demo/d/f/initiates 
/demo/d/g/initiates 
h,success 
/demo/d/h/initiates 
i,success 
/demo/d/i/initiates 
j,fatal 
/demo/d/j/initiates 
 
Schedule> more /demo/d/h /prerequisites 
 
/demo/d/h/prerequisites 
f 
 
 
 

The same information about the initiates and prerequisites can be viewed within the MOTIF Editor/Monitor, as below.


See the chapter on the MOTIF Editor/Monitor for a complete description of the editing and viewing capabilities.

5.2.3 Specify job actions

Each job has a script that can be edited to specify the commands to be executed when the job runs.

To edit the command list for each job, use the following command:


 
Schedule> edjob /demo/d/a1 -commands 
 

Since this job sequence is only simulating the task of updating the database, within the editor only the command to wait is entered:


 
sleep 'p1' 
 
 

The 'P1' part of the wait command is the standard command file variable. This variable is supplied as a submit parameter for all of the jobs in /demo/d/ by the following command:


 
Schedule> chjob /demo/d/* -submit=parameter:"00:00:30" 
 
 

Up to eight submit parameters can be entered in this way. This sets up each job to simply wait for 30 seconds before initiating the jobs in the initiate list of that job. The only exception is that job A3, which just serves as a return point in the job flow, has an empty command list and therefore will not wait.

To view the command lists and submit parameters, use the following commands:


 
 
 
Schedule> more /demo/d/* -commands 
 
/demo/d/a1/commands 
$ sleep 'p1' 
/demo/d/a2/commands 
$ sleep 'p1' 
/demo/d/a3/commands 
 
/demo/d/b1/commands 
$ sleep 'p1' 
/demo/d/b21/commands 
$ sleep 'p1' 
/demo/d/b22/commands 
$ sleep 'p1' 
/demo/d/b23/commands 
$ sleep 'p1' 
/demo/d/b24/commands 
$ sleep 'p1' 
/demo/d/c/commands 
$ sleep 'p1' 
/demo/d/d/commands 
$ sleep 'p1' 
/demo/d/e/commands 
$ sleep 'p1' 
/demo/d/f/commands 
$ sleep 'p1' 
/demo/d/g/commands 
$ sleep 'p1' 
/demo/d/h/commands 
$ sleep 'p1' 
/demo/d/i/commands 
$ sleep 'p1' 
/demo/d/j/commands 
$ sleep 'p1' 
 
Schedule> ls /demo/d/* -submit=parameter 
 
job directory /demo/d/ 
 
 
 
A1 "30","","","","","","","" 
A2 "30","","","","","","","" 
A3 "30","","","","","","","" 
B1 "30","","","","","","","" 
B21 "30","","","","","","","" 
B22 "30","","","","","","","" 
B23 "30","","","","","","","" 
B24 "30","","","","","","","" 
C "30","","","","","","","" 
D "30","","","","","","","" 
E "30","","","","","","","" 
F "30","","","","","","","" 
G "30","","","","","","","" 
H "30","","","","","","","" 
I "30","","","","","","","" 
J "30","","","","","","","" 
 
Total of 16 jobs 
 
 

5.2.4 Setup notifications

Each job can be configured to notify one or more users of certain events (SUBMITTED, STARTED, DELAYED, COMPLETED, and FAILED) pertaining to the job.

To arrange for notification upon the failure of job A1, use the following command:


 
Schedule> chjob /demo/d/a1 -notify=failed:(jdoe,mail,broadcast) 
 

Each job has a notification list that can be edited to specify the text of the notifications of certain events pertaining to this job.

To edit the notification list for job A1, use the following command:


 
Schedule> edjob /demo/d/a1 -notices 
 

Within the editor enter the notification text:


 
BEGIN_FAILED 
Job A1 has failed. Correct the cause of the failure and manually 
resubmit job A1. 
END_FAILED 
 

To confirm the notification information for job A1, use the following commands:


 
 
 
 
Schedule> ls /demo/d/a1 -notify=failed 
 
job directory /demo/d/ 
 
a1 jdoe,mail,broadcast 
 
total of 1 job 
 
Schedule> more /demo/d/a1 -notices 
 
/demo/d/a1/notices 
 
 
 
 
BEGIN_FAILED 
Job A1 has failed. Correct the cause of the failure and manually 
resubmit job A1. 
END_FAILED 
 

5.2.5 Scheduling the execution

The first job in the job sequence, job A1, is the one job that needs to be scheduled to run. All of the other jobs are initiated by the results of job A1 and subsequent jobs.

To schedule job A1 to run at 9 AM of each workday, starting January 2nd of 1996, use the following commands:


 
 
 
Schedule> chjob /demo/d/a1 -rescheduling=(interval:1-00:00,- 
calendar:workdays) 
Schedule> chjob /demo/d/a1 -general=next_submit:02-jan-1996:9:00 
 
 
 
 

The WORKDAYS calendar is one of the calendars supplied in the /default/ directory. This calendar excludes all Saturdays and Sundays and holidays. If there is a WORKDAYS calendar in the /demo/d/ or /demo/ directory, that calendar will be used in place of the /default/ directory calendar. The holidays are specified in the HOLIDAYS calendar. There is a HOLIDAYS calendar supplied in the /default/ directory. This calendar will be superseded by a HOLIDAY calendar in the /demo/d/ or /demo/ directory.

To confirm the scheduling for job A1, use the following commands:


 
 
Schedule> chjob /demo/d/a1 -rescheduling 
job directory /demo/d/ 
 
a1 interval=1-00:00:00.00, calendar=workdays 
 
total of 1 job 
Schedule> chjob /demo/d/a1 -general=next_submit 
 
job directory /demo/d/ 
 
a1 january 2, 1996, 09:00 
 
total of 1 job 
 
 

5.3 Run the job sequence

There are two ways to run the job sequence. The first way is the normal scheduled execution of job A1, in this case every work day at 9AM, starting on January 2nd of 1996. The other way is to manually submit job A1 for execution.

5.3.1 Manual submit

To manually submit job A1, use the following command:


 
 
Schedule> subjob /demo/d/a1 -initiates 
queued /demo/d/a1 for immediate submission 
 
 

5.3.2 View snapshot of event queues

Each job progresses from waiting to start through job completion by passing through a series of event queues. A snapshot of this progression can be viewed by the following command:


 
 
Schedule> catque * 
 
scheduling queue a: identify next start time 
 
scheduling queue b: waiting for start time to occur 
 
626. /demo/d/a1 (0) holding until January 2, 1996, 09:00 
 
 
 
Scheduling queue C: Initiated with NO set id. 
 
Scheduling queue D: Initiated with a set id. 
 
Scheduling queue E: Waiting for local prerequisites 
 
Scheduling queue F: Request remote completion codes 
 
Scheduling queue G: Waiting for remote prerequisites 
 
Scheduling queue H: Waiting for a required file 
 
Scheduling queue I: Waiting for disk space requirements 
 
Scheduling queue J: Ready to submit into execution queue 
 
Scheduling queue K: Submitted for execution 
 
 
 
 
79. /demo/d/b21 (1546) execution queue entry 653 
 
Scheduling queue L: Execution started 
 
Scheduling queue M: Job completed 
 
Scheduling queue N: Initiate descendant jobs 
 
Scheduling queue O: Send initiation to a remote node 
 
Scheduling queue P: Holding previous completions 
 
64. /demo/d/a1 (1546) Completed on December 12, 1996, 13:30 
681. /demo/d/a2 (1546) Completed on December 12, 1996, 13:31 
80. /demo/d/a3 (1546) Completed on December 12, 1996, 13:32 
86. /demo/d/b1 (1546) Completed on December 12, 1996, 13:33 
 
 
 
Scheduling queue Q: Event signals 
 
Scheduling queue R: Job completion messages 
 
Scheduling queue S: Remote completion requests 
 
 
 
 

5.3.3 Monitor event queues

The progression of job events can be monitored on a continuous basis. If job A1 is manually submitted by the following command:


 
 
 
Schedule> subjob /demo/d/a1 -initiates 
queued /demo/d/a1 for immediate submission 
 
 
 

then the resulting events can be monitored by the following command:


 
 
Schedule> monitor -queue -current -all * 
P Old comp 88. /demo/d/a1 (1560) Failed on December 13, 1996, 09:59 
M Completed 91. /demo/d/a1 (1562) Completed on December 13,1996, 11:08 
N Int desc 80. /demo/d/a1 (1562) 
P Old comp 91. /demo/d/a1 (1562) Completed on December 13,1996, 11:09 
B Wtfr start 86. /demo/d/a2 (1562) 
D Inttd id 86. /demo/d/a2 (1562) 
E Wtfr prereq 86. /demo/d/a2 (1562) 
H Wtfr file 86. /demo/d/a2 (1562) Waiting for file 
I Wtfr disk 86. /demo/d/a2 (1562) Waiting for 0 blocks on 
J Submitting 86. /demo/d/a2 (1562) 
K Submitted 86. /demo/d/a2 (1562) Execution queue entry 707 
L Started 86. /demo/d/a2 (1562) Execution queue entry 707 
M Completed 86. /demo/d/a2 (1562) Completed on December 13,1996, 11:10 
N Int desc 681. /demo/d/a2 (1562) 
P Old comp 86. /demo/d/a2 (1562) Completed on December 13,1996, 11:10 
B Wtfr start 90. /demo/d/a3 (1562) 
 
 

This output will continue until interrupted.


Previous Next Contents Index