Automatically handle activities that fail

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sumitgulati
Participant
Posts: 197
Joined: Mon Feb 17, 2003 11:20 pm
Location: India

Automatically handle activities that fail

Post by sumitgulati »

Hi All,

I have a Sequencer Job that calls a Server Job. I want the Sequencer Job to abort/throw warnings if the called Server Job aborts/throws warnings. I know one way to implement this is to call a routine Utility????ToLog also from the Sequencer Job. But since I am on version 7.1 I checked the option "Automatically handle activities that fail" in Sequence tab in administrator. This is not working. I tried recompiling the Sequencer Job, I also restarted DS services but it does not work.

After checking option "Automatically handle activities that fail" do I have to do anything else?

Thanks in advance
-Sumit
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

In what way is it not working? What is it not doing that you are expecting it to do? :?

This option doesn't seem to do a whole heck of alot, from what I read about it. And for it to work at all you have to not use your own "error" triggers in the Sequencer. Other than that, it is simply a matter of checking the box and it will add some code for you when you compile the job, all behind the scenes.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You need to also check add checkpoints so sequence is restartable. You need an exception handler stage. We usually route this to an email notification and a routine activity which calls UtilityAbortToLog.
Mamu Kim
sumitgulati
Participant
Posts: 197
Joined: Mon Feb 17, 2003 11:20 pm
Location: India

Post by sumitgulati »

If a Server Job aborts, the Sequencer that called this server job still is shown in FINISHED status. Ideally the Sequencer jobs should also abort. I guess thats what "Automatically handle activities that fail" option is meant to do. But it does not seem to be working.

Regards,
Sumit
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

That is why you have to run UtilityAbortToLog to show this sequence as failed or aborted.

The good part of this is to automatically start where it failed. It works great.
Mamu Kim
sumitgulati
Participant
Posts: 197
Joined: Mon Feb 17, 2003 11:20 pm
Location: India

Post by sumitgulati »

Kim, If I still have to explicitly use UtilityAbortToLog/UtilityWarnToLog then what is "Automatically handle activities that fail" option for?
My understanding says that if we check "Automatically handle activities that fail" in the administrator the while creating the sequencer it automatically puts an extra piece of code in sequencer job. This extra code is to reflect child job's abort in the parent job. Please correct me if I am wrong.

Regards,
Sumit
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Not really. The exception handler traps any event that you do not trap yourself. So if you trap executed ok and warnings then it will trap any other return value. If you only have an OK link then warnings will go thru the exception handler.

The UtilityAbortToLog is so this sequence aborts so the parent sequence will see the abort.

I like the way it works. Lots of control and very flexible.
Mamu Kim
Xanadu
Participant
Posts: 61
Joined: Thu Jul 22, 2004 9:29 am

Post by Xanadu »

sumitgulati wrote:Kim, If I still have to explicitly use UtilityAbortToLog/UtilityWarnToLog then what is "Automatically handle activities that fail" option for? My understanding says that if we check "Automatically handle activities that fail" in the administrator the while creating the sequencer it automatically puts an extra piece of code in sequencer job. This extra code is to reflect child job's abort in the parent job. Please correct me if I am wrong.

Regards,
Sumit
That was exactly my thought Sumit. Whenever I am using a routine stage in the sequence my sequence fails because the routine returns a non-zero value.
(I am working on the PSFT EPM jobs - this problem comes up when doing the incremental loads..)
Did you figure out an easy way to solve the problem ?

Thanks in adv
-Xanadu
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I think the same issue is in effect. A routine needs to return a 0 for "OK". The way a sequence works is very powerful you can tell it to ignore the result of this routine by doing an otherwise. You can also tell it to not make this step restartable which means it will not care if this step fails. Very cool. You can trap for a error an not execute the error handler. I do not see a problem here. You just have to tell it exactly what to do. It cannot guess what is an error or guess what to do. You have to trap each return code and what you do not have a trigger on is going to the error handler.

When you get used to this then you will like it. It just is not intuitive at first. It may mean you have 2 triggers on one job like "OK" and another for warnings. This means you will need a sequence with "Any" selected because you cannot get both results from one job.

Adjust to it. They did sequences right this time.
Mamu Kim
Xanadu
Participant
Posts: 61
Joined: Thu Jul 22, 2004 9:29 am

Post by Xanadu »

thats cool... let me restate so that i can confirm if I am understanding it right..

1) so if I have this in the sequence
Routine-->Job
2) I put the trigger in the routine as otherwise
3) enable the "automatically handle the activities that fail.." in the sequence.

Then the sequence would ignore the return code of the routine...(doesn't care about the status of the routine..)
But when the job in the sequence fails, the sequence fails too ?

Thanks Duke.
-Xanadu
kiran_kom
Participant
Posts: 29
Joined: Mon Jan 12, 2004 10:51 pm

Post by kiran_kom »

Xanadu wrote:thats cool... let me restate so that i can confirm if I am understanding it right..

1) so if I have this in the sequence
Routine-->Job
2) I put the trigger in the routine as otherwise
3) enable the "automatically handle the activities that fail.." in the sequence.

Then the sequence would ignore the return code of the routine...(doesn't care about the status of the routine..)
But when the job in the sequence fails, the sequence fails too ?

Thanks Duke.
-Xanadu
Yes it would. Look at the code generated under the job control page. It will be obvould how the sequence is going to behave..
shaimil
Charter Member
Charter Member
Posts: 37
Joined: Fri Feb 28, 2003 5:37 am
Location: UK

What about User Status

Post by shaimil »

For routines to work correctly I see that 0 is required for a success. What is the case for User Status. How can I use this with restartable sequences?
Post Reply