Jobs abort list in sequencer
Moderators: chulett, rschirm, roy
Jobs abort list in sequencer
Hi Guys,
Requirement: - fetch the over all job status in a sequencer; send an email alert if any of the jobs aborts in the sequencer via control job.
I have a main control job which runs the sequencer in which I have around 30 job activities attached all running as multiple instances.
I believe I have to write this in a main control job that runs the sequencer, hence I was trying to get the over all sequencer status and write the email alert based on that, but the sequencer status is always (Finished OK) even the jobs inside the sequence aborts
Status = DSGetJobInfo(hJob2, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
reply= DSSendMail("From:x\nTo:y\nSubject:load failed\nServer:xx\nBody:%fullreport%")
end
reply= DSSendMail("From:x\nTo:y\nSubject:load success\nServer:xx\nBody:%fullreport%")
Kindly plz advice
Many thanks
R
Requirement: - fetch the over all job status in a sequencer; send an email alert if any of the jobs aborts in the sequencer via control job.
I have a main control job which runs the sequencer in which I have around 30 job activities attached all running as multiple instances.
I believe I have to write this in a main control job that runs the sequencer, hence I was trying to get the over all sequencer status and write the email alert based on that, but the sequencer status is always (Finished OK) even the jobs inside the sequence aborts
Status = DSGetJobInfo(hJob2, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
reply= DSSendMail("From:x\nTo:y\nSubject:load failed\nServer:xx\nBody:%fullreport%")
end
reply= DSSendMail("From:x\nTo:y\nSubject:load success\nServer:xx\nBody:%fullreport%")
Kindly plz advice
Many thanks
R
That is due to the fact that you are handling it appropriately within your code. In your present code, you are checking the status and if it fails, you are sending out an email. According to the "Main Job", its executing all the statements properly and hence will not abort.
I think thats a good practice. The sequence finishes gracefully and you get a notification that a job failed. If you really want it to abort then you need to abort it within the code.
I think thats a good practice. The sequence finishes gracefully and you get a notification that a job failed. If you really want it to abort then you need to abort it within the code.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Re: Jobs abort list in sequencer
Won't it fail if you make a call to UtilityAbortToLog after If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then ...? Try that if you want the Sequence to fail as well. But like DSGuru said, you have handled the exception by sending out an email, so it will not abort even if the attached job fails.
gateleys
gateleys
chulett,
Its 7.1, is there any other way than the suggested approach, since I have 30 jobs attached in a sequencer and linking all jobs to a exception and notification looks bit messy...
However is there any simple way to abort the main sequencer if any of the jobs inside it fails, so that I can right a simple peace of code in my control job and send the notification?
Many Thanks
R
Its 7.1, is there any other way than the suggested approach, since I have 30 jobs attached in a sequencer and linking all jobs to a exception and notification looks bit messy...
However is there any simple way to abort the main sequencer if any of the jobs inside it fails, so that I can right a simple peace of code in my control job and send the notification?
Many Thanks
R
No, you don't need connectors from any of the jobs to the Exception handler. Just add: ExceptionHandler--->Notification--->Terminator (or routine to call DSLogFatal) to your sequence, and check the 'Automatically handle errors' in the sequence properties.Rajender wrote:since I have 30 jobs attached in a sequencer and linking all jobs to a exception and notification looks bit messy...
gateleys
Sure... upgrade.Rajender wrote:However is there any simple way to abort the main sequencer if any of the jobs inside it fails, so that I can right a simple peace of code in my control job and send the notification?
Major changes to Sequence functionality in 7.5.x which you will find very helpful in this endeavor.
Gateleys - that advice only applies to 7.5.x versions, pretty sure someone on 7.1 is still stuck with the 'spider on crack' approach.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Within job control, you may make a call after checking the job status-
gateleys
Code: Select all
Call DSLogFail(SequenceName, 'Job Failed')
You mean DSLogFatal
Heres the syntax
Heres the syntax
Code: Select all
Call DSLogFatal (Message,CallingProgName)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Ok, i think i am giving solution for aborting the Main Control Job.
If your controlling the process sequence using DS Basic coding, then you make an explicit call to DSLogFatal().
If you are controlling the process via sequence job, then you need to handle it within the sequence. I do not remember if you have routine activity stage in 7.1. If you do then you can call the routine UtilityAbortToLog() if any job fails. Then again, as Craig pointed out, you will have to do that via spider web.
Easy way out, an upgrade
If your controlling the process sequence using DS Basic coding, then you make an explicit call to DSLogFatal().
If you are controlling the process via sequence job, then you need to handle it within the sequence. I do not remember if you have routine activity stage in 7.1. If you do then you can call the routine UtilityAbortToLog() if any job fails. Then again, as Craig pointed out, you will have to do that via spider web.
Easy way out, an upgrade
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
How have you coded your JobControl to attach each job? Now, from the above code that you have supplied, assuming the job handle hJob corresponds to each job currently under execution, then the sequence can be aborted with -Rajender wrote:DSguru2b,
Sorry but not clear, how can I make DSLogFatal dynamic i mean it should only abort the main sequence once any of the embedded/attahced job fails
Many Thanks
R
Code: Select all
Status = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
reply= DSSendMail("From:x\nTo:y\nSubject:load failed\nServer:xx\nBody:%fullreport%")
Call DSLogFatal ("Sequence aborted due to failed job", hJob)
end