Page 1 of 1

Difference between Terminator and Exception Handler stages

Posted: Fri Jun 08, 2007 10:53 am
by abc123
I have 2 questions:

1)The Exception Handler CAN be used to execute a path (other job activities and execute command stages) in the job sequence after a certain exception occurs. Right?

2)An Exception Handler CANNOT be connected to a job activity/execute command activity stage whereas a Terminator can only be connected to a job activity/execute command activity stage, Right?

Thanks to anyone who responds.

Posted: Fri Jun 08, 2007 11:59 am
by uegodawa
Exception Handler is for Unhandled Exceptions. Suppose you've a sequence of job activities. Each job actvity (called a DataStage Job) and trigger next job if the <JobName>.$Status = 1 (Finished) , But what if previous job aborted ?
In such situations exception handler can handle those unhandled exceptions in a job sequence or Simply you can hook a Terminator stage to the previous job which caused the problem.

If you want to use exception Handler ;
1. Same sequence create another set of links like

Exeception Handler -> Job Activity -> Terminator.

2. In your job activity you can call a job or a routine which handles those unhandled exceptions.

One suggestion: send an email to the support group saying job has been aborted by creating a server routine.

Hope this explains about Exception Handler.

Posted: Fri Jun 08, 2007 12:35 pm
by abc123
The Exception Handler does not accept any input links whereas the Terminator stage does.

1)Does that mean that we put the Exception Handler anywhere on the sequencer?

2)Does this mean that whenever an exception occurs, that is an execution status other than OK in a job activity or execute command stage, the Exception Handler is executed? This will probably mean that there can only 1 Exception Handler in the entire sequencer job, right?

3)What would the role of the Terminator stage be?

Posted: Fri Jun 08, 2007 12:42 pm
by abc123
Also, what is the difference between "Executed OK" and <JobName>.$Status = 1? I would think that "<JobName>.$Status = 1? (Finished)" is the same as "Executed OK and/or Execution finished with warnings".

Posted: Fri Jun 08, 2007 12:47 pm
by DSguru2B
abc123 wrote:The Exception Handler does not accept any input links whereas the Terminator stage does.

1)Does that mean that we put the Exception Handler anywhere on the sequencer?
Yes anywhere. When an exception occurs as explained, the control will be passed on to the exception handler, no matter where it is.
abc123 wrote: 2)Does this mean that whenever an exception occurs, that is an execution status other than OK in a job activity or execute command stage, the Exception Handler is executed? This will probably mean that there can only 1 Exception Handler in the entire sequencer job, right?
Yes, only one exception handler. Any unhandled exception. If you handled status 1, and 2. Then the control wont go to the exception handler if your job finished with status 2 as you have already handled that. Get the picture.
abc123 wrote: 3)What would the role of the Terminator stage be?
To forcefully terminate the sequence job.

Posted: Fri Jun 08, 2007 12:49 pm
by uegodawa
1)Does that mean that we put the Exception Handler anywhere on the sequencer?

NOT sequencer stage. This just a new path as I explained. Please note that Exception Handler is the first stage in that path ( No Input Links)

Exception Handler -> Jobactivity -> Terminator.


2)Does this mean that whenever an exception occurs, that is an execution status other than OK in a job activity or execute command stage, the Exception Handler is executed? This will probably mean that there can only 1 Exception Handler in the entire sequencer job, right?

Exactly. You got the pount.

3)What would the role of the Terminator stage be?
Abort the sequence

Posted: Fri Jun 08, 2007 12:53 pm
by uegodawa
Also, what is the difference between "Executed OK" and <JobName>.$Status = 1? I would think that "<JobName>.$Status = 1? (Finished)" is the same as "Executed OK and/or Execution finished with warnings".

Goto the Triggers
Select Custom Expression
Under Expression box right-mouse select Activity Variable
Click on your job actvity, you might see $JobName, $JobStatus, $UserStaus

Where
$JobStaus =1 Finished Ok
$JobStaus =2 Finished Ok( with warnings)

Posted: Fri Jun 08, 2007 2:36 pm
by gateleys
Don't forget to set the Automatically handle failed jobs in the properties to take care of the aborted job(s) in the sequence.

gateleys

Posted: Mon Jun 11, 2007 9:01 am
by abc123
2 more questions:

1)
The 3 parameters, stage_label.$ErrSource, stage_label.$ErrNumber and stage_label.$ErrMessage, do they
get logged automatically in the log for the sequence job? I would assume that the Message Text in the
Terminator Activity stage also gets logged.

2)
How do you raise an error to test the error handling process?

Posted: Mon Jun 11, 2007 12:59 pm
by uegodawa
1)
stage_label.$ErrSource. This is the stage label of the activity stage that raised the exception (for example, the job activity stage calling a job that failed to run).

stage_label.$ErrNumber. Indicates the reason the Exception Handler activity was invoked, and is one of:

1. Activity ran a job but it aborted, and there was no specific handler set up.

-1. Job failed to run for some reason.

stage_label.$ErrMessage. The text of the message that will be logged as a warning when the exception is raised


2) You can abort a job which is invoked by job activity. For example suppose you're connecting to a database stage, just give a wrong user id or password for the DB stage, then that job will aborted and Exception handler will handle the situation.

Posted: Mon Jun 11, 2007 4:00 pm
by ray.wurlod
An Exception Handler can be connected to anything. The Exception Handler may be triggered by failure of an activity for which no explicit failure handling is provided. An Exception Handler can only have an output, never an input. It is analogous to a signal handler in C.

A Terminator activity can be connected from anything. It must be the final activity in its sequence of processing. That is, a Terminator activity can only have an input.

Posted: Tue Mar 26, 2013 1:22 pm
by nvalia
If you have 3 job activity stages in the Sequence job, and even if we handle the failure for 1 of the 3 jobs, the Exception Handler will NOT be triggered.

For the Exception Handler to be triggered, there cannot be ANY exception handling in any stage in the Sequence.

Also End the Exception Handler stage with a Terminator Activity stage to cleanly handle the failure (means the Seq job will show an Aborted state)