Page 1 of 2

How to use the exception handler

Posted: Fri Mar 25, 2011 3:28 am
by tanaya.deshpande@tieto.co
I want to use exception handler in a sequence in such a way that sequence should run three times in case it aborts and after 3rd time it should stop

I have checked the two options
add checkpoints so the sequence is restartable ..
Automaticaly handle activities that fail..

Posted: Fri Mar 25, 2011 3:41 am
by Ravi.K
As an initial step try with below logic.

Maintain counter variable and for each abort increment the counter variable by 1 when it meets counter value 3 then stop the sequence using Terminator activity.

Exception handler --> Nested Condition --> Teminator Activity.

Re: How to use the exception handler

Posted: Fri Mar 25, 2011 6:51 am
by chulett
tanaya.deshpande@tieto.co wrote:sequence should run three times in case it aborts and after 3rd time it should stop
Can't be done with any stage inside the sequence. That's something your external job control will need to handle.

Posted: Fri Mar 25, 2011 7:03 am
by tanaya.deshpande@tieto.co
May be I have explained it incorrectly I will try it again ..

I want to use exception handler in such a way that
sequence should run three times in case it aborts and after 3rd time it should stop

Posted: Fri Mar 25, 2011 7:22 am
by chulett
Saying the exact same thing again doesn't go a long way towards changing our understanding. And my same answer still applies. If the Sequence aborts, it is dead so nothing inside the Sequence will help rerun it.

Posted: Fri Mar 25, 2011 10:31 am
by chulett
Now... if you actually mean you want to try running a Job Activity three times in case the job (not the Sequence) aborts, that is perfectly feasible. Still won't need an Exception Handler for that, the Start/End Loop stages will get you what you need.

Posted: Fri Mar 25, 2011 11:30 am
by Ravi.K
Yep, we could exclude Exception Hanlder. When counter meets 3 then redirect to Teminator Activity to stop Sequence.

Posted: Sat Mar 26, 2011 4:03 am
by tanaya.deshpande@tieto.co
can you please give its design ...

Posted: Sat Mar 26, 2011 7:36 am
by chulett
Have you used the Loop stages before? This would be a pretty simple design - run the job inside the Loop stages, tell it to loop three times and use triggers to check the job's completion status to decide what to do each iteration.

Job ran ok? Exit the loop 'early' by branching to a stage after the End Loop stage. Use a Sequencer for a 'do nothing' stage if that's appropriate.

Job aborted? Continue the loop.

Job aborted for the 3rd time? The loop will automatically end at that point, branch from the End Loop stage to whatever stage would be appropriate in that case. As noted, perhaps a Terminator if you want to abort the Sequence in that case.

Posted: Wed Mar 30, 2011 10:05 pm
by tanaya.deshpande@tieto.co
Thanks Chulett for your reply..I still have one doubt

Here are the steps the sequence will run..

1) If Job activity success (don't enter the loop) exit loop..
2) if the job activity fails ..enter loop
iteration 1:
if Job activity success ..exit loop
3) If job activity fails now ...enter loop
now will the iteration be 2nd or again the first iteration will start????

I am asking u this question because I am not able to test what I am doubting

Posted: Wed Mar 30, 2011 10:33 pm
by chulett
2) and 3) are not 'enter loop', it is continue loop as you only enter it once... and yes, the counter / iteration will automatically increment each time you take another lap around the loop.

Posted: Thu Mar 31, 2011 12:26 am
by tanaya.deshpande@tieto.co
Thanks a lot Ravi and Chulett my problem is solved... :D

Posted: Thu Mar 31, 2011 3:58 am
by tanaya.deshpande@tieto.co
I was succesful in executing that code when there was one job activity

I joined start and endloop to the activity and in the trigger of that activity I gave condition failed ...

But now if I have more than 1 job activity and I want to run the loop when any of the activity fails then how to do it ???

Posted: Thu Mar 31, 2011 6:15 am
by tanaya.deshpande@tieto.co
Is there any activity to forcefully stop the sequence

Posted: Thu Mar 31, 2011 6:21 am
by chulett
tanaya.deshpande@tieto.co wrote:But now if I have more than 1 job activity and I want to run the loop when any of the activity fails then how to do it ???
You certain you want to do that - rerun all of them if any one of them fails? If so, seems to me it would be custom triggers checking all results and deciding where to go, out or back around. Probably in a Nested Condition stage.