I have a multi-job setup in which a "Main" sequence calls a "Sub" sequence, which runs actual processes. If a process fails, the "Sub" sequence aborts and the "Main" sequence aborts. I have an Execution Action on all sequences, "Reset if required, then run", which will reset and run the "Sub" sequence and actual process using the "Main" sequence, but only after I have manually reset the "Main" sequence.
How can I dynamically reset the "Main" sequence, which is a scheduled job to avoid manual intervention? Any thoughts?
Thanks in advance
Resetting an aborted sequence
Moderators: chulett, rschirm, roy
Re: Resetting an aborted sequence
Welcome to DSXchange.
The idea is to have your main sequence such that it does not abort under normal circumstances. I, normally, wrapper my MAIN sequence in another sequence .... let's call it the INIT sequence. The INIT sequence calls the MAIN sequence (which is set to 'Reset and Run if Required). However, failure of MAIN is NOT propagated to INIT. This way, INIT will always finish OK.
gateleys
The idea is to have your main sequence such that it does not abort under normal circumstances. I, normally, wrapper my MAIN sequence in another sequence .... let's call it the INIT sequence. The INIT sequence calls the MAIN sequence (which is set to 'Reset and Run if Required). However, failure of MAIN is NOT propagated to INIT. This way, INIT will always finish OK.
gateleys
Re: Resetting an aborted sequence
I think you can call your main sequence in a unix script but you have to write one or find one written, I am not that expert in writing a script to run a datastage job but it is not that hard. search the forum or internet. The idea is to just call the main sequence in a loop that try to run it as many times as long as it aborts , quit the loop if the main sequence completed OK or that many number of trials have been reached ( 3, 5). you need to capture the status of the main sequence to decide if you need to try to run again ( ofcourse you need to reset the sequence automatically in the loop as well) or quit the loop.
Maybe some people in this forum can provide you a sample script so that you can use it. I hope it helps.
Maybe some people in this forum can provide you a sample script so that you can use it. I hope it helps.
Thanks,
Chad
__________________________________________________________________
"There are three kinds of people in this world; Ones who know how to count and the others who don't know how to count !"
Chad
__________________________________________________________________
"There are three kinds of people in this world; Ones who know how to count and the others who don't know how to count !"
Reply
It seems how ever I wrap it, all the sequences seem to abort or maybe I'm not calling it correctly. How can the INIT sequence not be affected by the sequence it is calling?
I have tested the below code, set in a "control" job, that can be run before the "Main_Sequence" is scheduled, which will reset just the "Main" sequence and all jobs attached will automatically run. I was trying to avoid that if at all possible.
* DEFINE FIRST SEQ - RESET SEQ
hJob1 = DSAttachJob("MAIN_SEQUENCE", DSJ.ERRFATAL)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
Call DSLogInfo("JOB STATUS ":Status, msgs)
If Status = 21 or Status = 99 then
End Else
ErrCode = DSSetDisableProjectHandler(hJob1, @FALSE)
ErrCode = DSSetDisableJobHandler(hJob1, @FALSE)
ErrCode = DSRunJob(hJob1, DSJ.RUNRESET)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
End
I have tested the below code, set in a "control" job, that can be run before the "Main_Sequence" is scheduled, which will reset just the "Main" sequence and all jobs attached will automatically run. I was trying to avoid that if at all possible.
* DEFINE FIRST SEQ - RESET SEQ
hJob1 = DSAttachJob("MAIN_SEQUENCE", DSJ.ERRFATAL)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
Call DSLogInfo("JOB STATUS ":Status, msgs)
If Status = 21 or Status = 99 then
End Else
ErrCode = DSSetDisableProjectHandler(hJob1, @FALSE)
ErrCode = DSSetDisableJobHandler(hJob1, @FALSE)
ErrCode = DSRunJob(hJob1, DSJ.RUNRESET)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
End
Re: Reply
You can test what I had suggested.swwilbert wrote:How can the INIT sequence not be affected by the sequence it is calling?
1. Create a sequence job with any 1 or 2 jobs. Call this sequence MAINseq.
2. Create another sequence job called INITseq which contains only MAINseq. Do not embed any logic in this (INITseq) to abort the sequence in the event of any failures.
3. Introduce some error in any of your job in MAINseq to test if INITseq will also fails.
4. Run INITseq. Let me know what happens.
gateleys
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I still need to test all the possibilities, but what I have found is if the check box "Automatically Handle Activities that fail" is checked, the INIT Seq will abort, along with all the sub sequences. If it is unchecked, only the sub sequences abort and the INIT shows Finished. So to answer gateleys question, this will and does work as long as the INIT is unchecked.
Thanks for all the help.
Steve
Thanks for all the help.
Steve