exception handler vs failure trigger

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

exception handler vs failure trigger

Post by dsscholar »

Hi all,

I have a sequence design where if a job fails the sequence should be aborted. This can be achieved using failure trigger in the job and also by using exception handler. Whats the difference between these two. Is it good to use job trigger for job failure or exception handler is fine?

Thanks in advance
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Re: exception handler vs failure trigger

Post by BI-RMA »

dsscholar wrote: This can be achieved using failure trigger in the job
You mean: in the sequence?

That is not correct. A failure trigger ("Failed - (Conditional)") in a sequence will cause a job to run - only - when its predecessor ended with a fatal error (abort).

You can use an exception-handler to run some kind of cleanup-sequence if any of the jobs in a sequence end with a fatal error.

If you want your sequence to stop in case of failure or warning, set your triggers to "OK - (Conditional)". If you wish to allow warnings, too, test for job-status <= 2 ("Custom - (Conditional)"). All that will not abort the sequence itself. The sequence will only abort, if a job to be run is not in a runnable state (aborted in a previous run) or if you pass invalid or incomplete parameters to it.

You can use a Server-Routine calling DSLogFatal to make the Sequence abort.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Re: exception handler vs failure trigger

Post by dsscholar »

Consider this scenario.

In sequence job,

Job activity1---> failure trigger ---Sequence activity(any)
Job activity2---> failure trigger ---Pointing to above sequence activity ..

After this a terminator stage. Two job activities run in parallel.

Second scenario.

Two jobs run in parallel. And exception handler---> terminator, is used to abort in case of failure. Wats the difference in using failure triggers and exception handler in this specific scenario. Which is better?

If exception handler can handle this situation means, whats the use of failure triggers.


Thanks in advance.
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post by BI-RMA »

The triggers allow you to very specifically handle the job-status of a single job (and more - the "Custom - (Conditional)" option provides the same flexibility as the Nested-Condition-activity).
The exception-handler will usually trigger, if the sequence fails to start a job-activity altogether (invalid or incomplete parameters, job aborted or uncompiled). In this case the failure-trigger won't help, because the job won't run and therefore the trigger related to the job will not fire.

So it is not a question of "What is better?". Both serve a different purpose and you may actually need both to make sure you cleanup your environment after a failure-event.

The exception handler --> terminator scenario is pretty useless.

It may or may not stop a running job activity (resulting in an abort), depending on the time the job takes to complete. Short running jobs very often complete before the stop signal is received. A cleanup-activity is not started.

Connect your exception handler to the same sequencer (not a sequence-activity) used in your scenario 1 to handle all possible failure-events.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
Post Reply