Page 1 of 2

sequence job failure

Posted: Fri Jan 22, 2016 5:34 am
by deesh
Hi,

in my sequencer i have 5 jobs, if my 4th job fails, after reset the job, sequencer should be rerun from 3rd job not from 4th job.

Please some one give an idea how to achieve this activity without using routine.

Posted: Fri Jan 22, 2016 9:23 am
by ArndW
The normal functionality of restartable sequences does not let you do this, it stores the last successful stage and starts execution after that. You can read the status information ( using a routine ) and change the execution order using that information.

Posted: Fri Jan 22, 2016 2:54 pm
by ray.wurlod
Don't reset. Reset will clear the checkpoints. If the sequence status is "Aborted / Restartable" simply re-start it.

Posted: Fri Jan 22, 2016 2:56 pm
by chulett
You missed their issue, Ray. Job N fails and they want to restart from Job N-1, not N.

Posted: Fri Jan 22, 2016 5:07 pm
by rkashyap
I have seen a solution for this issue ...
1. While invoking the sequencer thru command-line, always pass reset parm. (dsjob run -mode RESET -wait <proj> <jobname> )
2. In first step of Sequencer, get last run's status (within past X hours).
3. If last run was aborted then depending on aborted subjob, pass control to required (N-1) subjob.

Needless to say, the DataStage canvas for Sequencer looks cluttered. Also if Operations Console is being used, then DSODB tables are quite helpful in finding out status of previous run.

Posted: Sun Jan 24, 2016 3:46 pm
by ray.wurlod
The second half of my earlier post somehow did not make it onto the forum. In it was the advice to mark the third activity "do not checkpoint run".

Posted: Sun Jan 24, 2016 8:58 pm
by asorrell
To be clear, by not check-pointing job 3, it means always run Job 3 during a restart, regardless of whether it was job 4, job 5 or any other downstream job that failed.

It does not mean "pick up" from Job 3 and continue.

For example, if Job 3 and 4 worked, and Job 5 failed, then the restarting the sequence would run Job 3, skip Job 4, and re-set and rerun Job 5.

Posted: Mon Jan 25, 2016 8:28 am
by chulett
I'm wondering is this is a generic question or a very specific one... as in are they asking about this specific job in this specific sequence specifically? Or is this meant to be more general where X fails and for some reason you'd want to start at X-1 generally.

:wink:

Posted: Tue Jan 26, 2016 4:15 pm
by ray.wurlod
I assumed that it was a specific question because of the lack of any "for example" or similar in the question.

Posted: Fri Jan 29, 2016 12:32 pm
by kduke
The best way to accomplish what you want is what we call touch files. So have a folder we put a sequential file in after each job runs successfully. Each file in a sequence is assigned a file. All files in a sequence start with the same name. All restartability is turned off. So if this file exists then do not run the job. The sequence does this check. If the file is not there then the job is ran.

Now you can manually or automatically delete any file to run all jobs or skip specific jobs.

Works great. Used it for years. You can script removing or adding these files as needed.

Posted: Fri Jan 29, 2016 4:58 pm
by asorrell
kduke wrote: All restartability is turned off.
Did you really mean to say "check-pointing" is turned off? Surely you'd still want the jobs all configured to re-set and re-run?

Posted: Sat Feb 06, 2016 11:01 am
by kduke
That is part of what I meant Andy. Check-pointing plus automatic handling and the job property settings need to be set properly so DataStage does not handle where to start next run. All that is handled by files. One file per job. You can create these in the sequence after a job runs successfully with an echo command or a touch command. We used to call them touch files for that reason.

The checkpoints try to control which job starts after a failed run. You need to turn all that logic off.

This helps other things work better as well. If you have steps in a sequence which calculate variables then these steps get skipped with restart and checkpoints set. These can always run if checkpointing and DataStage restartability is turned off. Makes life easier. Restarting a job the old way when it fails more than once was always a risk. Never seemed to work correctly.

Posted: Sat Feb 06, 2016 3:33 pm
by ray.wurlod
Kim, how does the "touch file" approach work if the job activity failure is at, say, the fourth iteration of a loop?

Posted: Mon Feb 08, 2016 7:01 pm
by kduke
Does not work within loops.

Posted: Mon Feb 08, 2016 8:58 pm
by ray.wurlod
FYI the checkpoint mechanism does work within loops.