SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Setting Job Dependencies

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Setting Job Dependencies
Author Message
Mark Chappell



Joined: 21 Jun 2000
Posts: 4

Post Setting Job Dependencies Reply with quote

I have a series of jobs that run in my daily batch cycle. The trigger for each of these jobs will be the combination of the successful completion of the "parent" job (which is obtained by reading a "Batch Control" database table) and the presence of any number of files.

For example, Job "1" is to be scheduled on weekdays starting at 5:00 PM. When Job "1" completes successfully, it writes an ending timestamp to the "Batch Control" table. If the job does not complete successfully, the ending timestamp will be null. In this case, a support person should be notified via email that an error has occurred.

Job "2" should only run when the ending timestamp for Job "1" is not null and the output files for Job "1" are present. Subsequent jobs (ie. Jobs "3", "4", etc.) will use similar dependencies.

What is the best method using 24x7 to schedule the above scenario, keeping in mind that if an error occurs the support person should be notified? Thanks.

Tue Jun 27, 2000 11:52 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Re: Setting Job Dependencies Reply with quote

So job "x" (where "x" > "1") can be setup as a "file-watch" job.
Such job should be also implemented as a JAL script.

First, create a user-defined statement in the Script Library that returns completion status for any given job (assuming it accepts some job ID as an argument and returns a boolean value - True if the job succeeded and False otherwise). This statement can be called by every "x" job to get the status of the parent job(s).

This statement would construct dynamic SQL query like (this is SQL Server prototype, you may need to rewrite it for your database server supported syntax)

SELECT isNull( max(convert(char(12), end_timestamp)), 'FAILED')
FROM batch_control_table
WHERE job_id = [some id inserted here]

Then the statement would run the query (DatabaseConnect, DatabaseRetrieve, DatabaseGet) and compare the returned value with 'FAILED'
If the result = 'FAILED', the statement will return "False", otherwise it will return "True".

Every job "x" can first call the statement described above to get the status of parent job(s).
If the status is "False" the job can disable itself (using JobDisable) to prevent from subsequent runs untill the problem is fixed and then notify the support person about which job has been disabled and the reason for that to help troubleshot the problem. For example the message could be like 'Job [bla...bla..bla..] has been terminated abnormally because it found that the prior job [bla...bla..bla..] failed. Please enable the job after you resolve this problem'. This message can be sent as an email (MailSend), or as a page (MailSend + email to pager gateway) or as a network message (use Run "NET SEND ..." command)

If the returned status is True (which means that the parent job was OK), the job "x" will do what you need it to do.

Now, every job that writes to the "Batch Control" table can use similar methods for updating the database (DatabaseConnect, Database Execute "INSERT INTO batch_control_table (job_id, end_timestamp) VALUES ([some id inserted here], GetData()) at the of the job and notify the support person if anything failed).

The described scenario is very common and it is used in many organizations as a standard job processing and auditing scenario. 24x7 Scheduler provides all the methods required for such implementation.
: I have a series of jobs that run in my daily batch cycle. The trigger for
: each of these jobs will be the combination of the successful completion of
: the "parent" job (which is obtained by reading a "Batch
: Control" database table) and the presence of any number of files.

: For example, Job "1" is to be scheduled on weekdays starting at
: 5:00 PM. When Job "1" completes successfully, it writes an
: ending timestamp to the "Batch Control" table. If the job does
: not complete successfully, the ending timestamp will be null. In this
: case, a support person should be notified via email that an error has
: occurred.

: Job "2" should only run when the ending timestamp for Job
: "1" is not null and the output files for Job "1" are
: present. Subsequent jobs (ie. Jobs "3", "4", etc.)
: will use similar dependencies.

: What is the best method using 24x7 to schedule the above scenario, keeping in
: mind that if an error occurs the support person should be notified?
: Thanks.

Tue Jun 27, 2000 1:00 pm View user's profile Send private message
Mark Chappell



Joined: 21 Jun 2000
Posts: 4

Post Re: Setting Job Dependencies Reply with quote

I'm assuming that the parent job(s) should create a semaphore file when either the job finishes, when an execution error occurs, or when an executable is not found.

If this is true, what prevents job "3" from executing when job "2" performs the user-defined statement and determines that job "1" did not complete successfully (assuming job "3" is waiting on the semaphore file created in job "2")?

I apologize if my questions seem basic, but I can't help it, they are. :)
Any help is greatly appreciated.

: So job "x" (where "x" > "1") can be setup as
: a "file-watch" job.
: Such job should be also implemented as a JAL script.

: First, create a user-defined statement in the Script Library that returns
: completion status for any given job (assuming it accepts some job ID as an
: argument and returns a boolean value - True if the job succeeded and False
: otherwise). This statement can be called by every "x" job to get
: the status of the parent job(s).

: This statement would construct dynamic SQL query like (this is SQL Server
: prototype, you may need to rewrite it for your database server supported
: syntax)

: SELECT isNull( max(convert(char(12), end_timestamp)), 'FAILED')
: FROM batch_control_table
: WHERE job_id = [some id inserted here]

: Then the statement would run the query (DatabaseConnect, DatabaseRetrieve,
: DatabaseGet) and compare the returned value with 'FAILED'
: If the result = 'FAILED', the statement will return "False",
: otherwise it will return "True".

: Every job "x" can first call the statement described above to get
: the status of parent job(s).
: If the status is "False" the job can disable itself (using
: JobDisable) to prevent from subsequent runs untill the problem is fixed
: and then notify the support person about which job has been disabled and
: the reason for that to help troubleshot the problem. For example the
: message could be like 'Job [bla...bla..bla..] has been terminated
: abnormally because it found that the prior job [bla...bla..bla..] failed.
: Please enable the job after you resolve this problem'. This message can be
: sent as an email (MailSend), or as a page (MailSend + email to pager
: gateway) or as a network message (use Run "NET SEND ..."
: command)

: If the returned status is True (which means that the parent job was OK), the
: job "x" will do what you need it to do.

: Now, every job that writes to the "Batch Control" table can use
: similar methods for updating the database (DatabaseConnect, Database
: Execute "INSERT INTO batch_control_table (job_id, end_timestamp)
: VALUES ([some id inserted here], GetData()) at the of the job and notify
: the support person if anything failed).

: The described scenario is very common and it is used in many organizations as
: a standard job processing and auditing scenario. 24x7 Scheduler provides
: all the methods required for such implementation.

Tue Jun 27, 2000 2:38 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Re: Setting Job Dependencies Reply with quote

The parent job(s) should create a semaphore file on finish if you want other jobs to start only after this file gets created. As for "error" conditions, don't let it to create this file if you don't want other jobs to start.

Therefore, if job "2" finished and created some semaphore file, 24x7 Schedule will kick off job "3" after it finds the file, then job "3" will go to database to check job "2" status, the "real status", not the completion flag, which is the semaphore file. You can have 24x7 to create the semaphore file or you can make job "2" to create it only if, from the job "2" point of view everything is fine.

From 24x7 Scheduler point of view, job "2" (if this is a program or a batch file) was successful if it finished in time. It has no way to know if job "2" failed because, for example, it didn't find required network connection, or your program terminated with the error written to some log file, or may be your program worked incorrectly because not all required data files arrived, ... as well as many many other conditions.

A lot of things depends on job details and business logic. What you consider as a failed job? How you detect that your job failed? How you implement error checking? When and how you create semaphore files or other "semaphore" objects such as records in database tables?

: I'm assuming that the parent job(s) should create a semaphore file when
: either the job finishes, when an execution error occurs, or when an
: executable is not found.

: If this is true, what prevents job "3" from executing when job
: "2" performs the user-defined statement and determines that job
: "1" did not complete successfully (assuming job "3" is
: waiting on the semaphore file created in job "2")?

: I apologize if my questions seem basic, but I can't help it, they are. :)
: Any help is greatly appreciated.

Tue Jun 27, 2000 3:57 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.